Issue #7388 has been updated by trans (Thomas Sawyer).


=begin
I thought about a few terms that might work in both cases, i.e. the so called "embed" case of this issue and the "identity" case of #6373. All of the obvious plays on the term "self" didn't fair too well. So I took a step back and asked what it was the method was really asking for. I answered, "a reference to the object itself". So then, it occurred to me, what about #reference?

  a.group_by(&:reference)

  a.reference{ |r| ... }

=end

----------------------------------------
Feature #7388: Object#embed
https://bugs.ruby-lang.org/issues/7388#change-33133

Author: zzak (Zachary Scott)
Status: Rejected
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=begin
From github:
https://github.com/ruby/ruby/pull/67

Add Object#embed which works like tap but returns the block's value

This avoids breaking from method chains in many cases. I don't see any other way to do this without this method.

Can someone confirm pull request are a valid way of submitting patches ? I cannot register on the mailing list for some reason, it seems to be broken.

Example:

(({[ 1, 2, 3, 4].select{|x| x.odd?}.embed{|x| {:total => x.count, :data => x}}}))
=end



-- 
http://bugs.ruby-lang.org/