The tap
method has been in Ruby since version 1.8.7 :
tap {| x | ...} => obj
Allowed x
to block, and then returns x
. The main goal of this method is to βuseβ the chain of methods in order to perform operations with intermediate results within the chain.
Note that 1.8.6 does not have Object#tap
. Presumably tap
was in older versions of Rails (like a monkey patch on Object
), but was added to Ruby in 1.8.7. Since version 1.8.6 is quite old, the version of Rails was deprecated and in later versions of Rails was completely removed.
1.9.3 still has Object#tap
, so tap
itself is not outdated, only the corrected version of Rails Monkey has been removed.
source share