Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
def foo(value)
"#{value}foo"
end
[1,2].map &method(:foo)
#=> ["1foo", "2foo"]
def foo(value)
"#{value[0]}foo"
end
[[1,2],[3,4]].map &method(:foo)
# ArgumentError: wrong number of arguments (2 for 1)
# from (irb):13:in `foo'
# from (irb):13:in `to_proc'
# from (irb):14:in `map'
# from (irb):14
# from :0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment