Issue #13172 has been updated by Dmitriy Non.


Matthew Kerwin wrote:
> * #6721
> * #6684
> * #7388
> * #10095
> * #11717
> * #12760

Well, obviously I can't use searching:D
So, what about naming?

#12760 leaves suggests `yield_self` name, but imho it's too long.

Check https://github.com/ruby/ruby/pull/1521 pls.


----------------------------------------
Feature #13172: Method that yields object to block and returns result
https://bugs.ruby-lang.org/issues/13172#change-62738

* Author: Dmitriy Non
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Hi everyone!

There's a `#tap` method, that yields reciever to block and returns reciever itself.
I would like to see method, which would return yield's result.

~~~
some_object.some_method.pass { |x| x && another_object.another_method(x) }
~~~

I've seen many code samples that had a some "middle-variables" to store `#some_method` result.
Those variables are useless after few lines of code, so it would be great to create them in a limited scope (block).

P.S. I am very sorry for my english. I hope you understood me:D
P.P.S. I think there should be a better name than `pass` for such method



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>