Chaining & to_proc on symbol
Es ist Rubyist bekannt&
werde anrufento_proc
auf einem Symbol, also
[:a, :b, :c].map(&:to_s)
ist äquivalent z
[:a, :b, :c].map { |e| e.to_s } # => ["a", "b", "c"]
Say Ich möchte eine andere Methode direkt nach @ aufrufto_s
, diese beiden Implementierungen funktionieren:
[:a, :b, :c].map { |e| e.to_s.upcase }
[:a, :b, :c].map(&:to_s).map(&:upcase)
Meine Frage ist, gibt es eine Möglichkeit, das @ zu verkett&
Symbol#to_proc
Aufruf in einem Parameter? Etwas wie
[:a, :b, :c].map(&:to_s:upcase)
Vielen Dank