Project

General

Profile

Actions

Feature #8896

open

#tap with missing block

Added by prijutme4ty (Ilya Vorontsov) over 10 years ago. Updated over 2 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:57134]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0