Smart pipe insertion in Ruby for procs and lambdas