* Add Object#embed which works like tap but returns the block's value #67
I'll add that I did not have any revelation on the method's name, i guess wrap would also be a nice candidate, happy to change that if needed. |
It's OK you posted here. Thoughts:
|
Hi shyouhei, Thanks for the quick reply. Here's some clarifications:
I hope this helps a little |
I think these other names could also be valid for this method:
|
any other thoughts regarding this PR ? |
Actually, Rails core have been considering introducing this method into ActiveSupport, but haven't come up with a good method name so far. BTW I would like to see this feature implemented in Ruby, but -1 for the method names |
how about doto then, so it doesn't step on the do block word |
the problem with do is that it would allow: [].do do |obj|
foo
end |
I'm happy to see it considered for rails, but since I use ruby mostly outside of rails and like to keep my gem dependency graph small, I'd be very happy to see this go in without having to pull in activerecord |
I think that with the recent addition of Enumerable#lazy this makes even more sense |
Closing this, I've opened up a ticket on redmine as feature #7388 |
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: