From: sean.m.huber@... Date: 2018-12-15T20:51:57+00:00 Subject: [ruby-core:90553] [CommonRuby Feature#15419] Allow Kernel#tap to be invoked with arguments like Kernel#send Issue #15419 has been reported by shuber (Sean Huber). ---------------------------------------- Feature #15419: Allow Kernel#tap to be invoked with arguments like Kernel#send https://bugs.ruby-lang.org/issues/15419 * Author: shuber (Sean Huber) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Tapping methods without any arguments already has nice shorthand via `Symbol#to_proc`: ```ruby object.tap { |o| o.example } # vs object.tap(&:example) ``` Unfortunately once other arguments are involved we have to switch back to the longer form: ```ruby array.merge(other).tap { |a| a.delete(object) } ``` [This patch](https://github.com/ruby/ruby/pull/2050) introduces a convenient and familiar shorthand for these cases which behaves similar to `Kernel#send`: ```ruby array.merge(other).tap(:delete, object) ``` Calling tap without any arguments or block still raises LocalJumpError ```ruby 3.tap #=> LocalJumpError: no block given ``` --- **Pull request**: https://github.com/ruby/ruby/pull/2050 -- https://bugs.ruby-lang.org/ Unsubscribe: