So with Ruby permitting Procs called on Objects I’ve found sometimes a Colon Method will work, and sometimes you need a Ampersand Colon Method. For example, when I map &:upcase on a list of strings it works.
|
["a","b","c"].map(&:upcase) # = > ["A", "B", "C"] |
But if I try without the Ampersand I get:
|
["a","b","c"].map(:upcase) # ArgumentError: wrong number of arguments (1 for 0) |
So for mapping it seems we need…
Continue Reading »