tap
Object#tap (Ruby 3.0.0 リファレンスマニュアル)
code:ruby
(1..10) .tap {|x| puts "original:
#{x}"
}
.to_a .tap {|x| puts "array:
#{x}"
}
.select {|x| x.even? } .tap {|x| puts "evens:
#{x}"
}
.map {|x| x*x } .tap {|x| puts "squares:
#{x}"
}