Created
January 13, 2009 22:49
-
-
Save knzai/46673 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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