Issue #8896 has been updated by shuber (Sean Huber).


`Kernel#tap` related: Allow `Kernel#tap` to be invoked with arguments like `Kernel#send` - https://bugs.ruby-lang.org/issues/15419

If the `LocalJumpError` breaking change from this ticket is not an issue then it'd be pretty easy to add logic to that PR^ supporting it.

----------------------------------------
Feature #8896: #tap with missing block
https://bugs.ruby-lang.org/issues/8896#change-75705

* Author: prijutme4ty (Ilya Vorontsov)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
In case when no block provided to tap, it fails. So if you want method which can be called with or without block - you can't do it like this:

def self.create(args={}, &block)
  new.set_attributes(args).tap(&block)
end

but should use block_defined? to prevent #tap's failure.

I suggest to make tap with no block given just to return self and raise no errors.




-- 
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>