Skip to content

Instantly share code, notes, and snippets.

@certainty
Created July 19, 2012 13:01
Show Gist options
  • Save certainty/3143730 to your computer and use it in GitHub Desktop.
Save certainty/3143730 to your computer and use it in GitHub Desktop.
Map method
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