class Object

not pulling in active-support JUST for this method. And I love this method.

def tap

Returns self.
Yields self.

tap { |x| puts "squares: #{x.inspect}" }
map { |x| x*x }.
tap { |x| puts "evens: #{x.inspect}" }.
select { |x| x%2 == 0 }.
tap { |x| puts "array: #{x.inspect}" }.
(1..10).tap { |x| puts "original: #{x.inspect}" }.to_a.

Examples

in order to perform operations on intermediate results within the chain.
The primary purpose of this method is to "tap into" a method chain,
def tap
  yield self
  self
end unless Object.respond_to?(:tap)