Given the following Ruby example:
"to_i".to_sym.to_proc.call("1")
To call #to_procon Symbol, a proc is created that takes one parameter: the object that should receive the call to the method called the symbol. Something like that:
->(object) {
object.send(:to_i)
}
&, , #to_proc . Enumerable#map ,
.
, ["1", "2"].map(&:to_i) - -
:
block = ->(el) {
el.send(:to_i)
}
["1", "2"].map &block
:
&to_i Ruby
to_i.
scope ( String Array, "" ), .
: "to_i".to_sym.to_proc
:to_i proc,
, (:to_i),
. , & proc
"-":
["1", "2"].map(&"to_i".to_sym.to_proc)