In Ruby symbol can be conveniently converted to a Proc such as:
%{john terry fiona}.map(&:capitalize) # -> %{John Terry Fiona}
Is there a way to pass a method to a Proc, to shorten the following code:
["john", "terry", "fiona"].each do |n|
assert n.valid_encoding?
end
Thanks.
1 Answer