From: non.dmitriy@... Date: 2017-01-31T03:40:59+00:00 Subject: [ruby-core:79321] [Ruby trunk Bug#13172] Object#pass (yield object to block and return result) Issue #13172 has been reported by Dmitriy Non. ---------------------------------------- Bug #13172: Object#pass (yield object to block and return result) https://bugs.ruby-lang.org/issues/13172 * Author: Dmitriy Non * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- 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 { |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 -- https://bugs.ruby-lang.org/ Unsubscribe: