Chaining & to_proc on symbol
问题 It's well known to Rubyist & will call to_proc on a symbol, so [:a, :b, :c].map(&:to_s) is equivalent to [:a, :b, :c].map { |e| e.to_s } # => ["a", "b", "c"] Say I want to call another method right after to_s , these two implementations will work: [:a, :b, :c].map { |e| e.to_s.upcase } [:a, :b, :c].map(&:to_s).map(&:upcase) My question is, is there a way to chain the & Symbol#to_proc call in one parameter? Something like: [:a, :b, :c].map(&:to_s:upcase) Thanks! 回答1: If you're only doing: %i[a