Created
July 19, 2012 13:01
-
-
Save certainty/3143730 to your computer and use it in GitHub Desktop.
Map method
This file contains 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
Object.send(:alias_method,:_m,:method) | |
class Foo | |
def reverse(thing) | |
thing.reverse | |
end | |
def map_reverse(things) | |
things.map(&_m(:reverse)) | |
end | |
end | |
Foo.new.map_reverse(%w(foo bar baz)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment