3 # obj.yield_self {|_obj|...} -> an_object
4 # obj.then {|_obj|...} -> an_object
6 # Yields <i>obj</i> and returns the result.
8 # 'my string'.yield_self {|s|s.upcase} #=> "MY STRING"
10 def yield_self(&block)
11 return to_enum :yield_self unless block
18 # obj.tap{|x|...} -> obj
20 # Yields <code>x</code> to the block, and then returns <code>x</code>.
21 # The primary purpose of this method is to "tap into" a method chain,
22 # in order to perform operations on intermediate results within the chain.
24 # (1..10) .tap {|x| puts "original: #{x.inspect}"}
25 # .to_a .tap {|x| puts "array: #{x.inspect}"}
26 # .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"}
27 # .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"}