Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'binding_of_caller'
module Enumerable
def my_map(sym)
[].tap do |r|
each do |e|
r << e.send(sym)
end
end
end
def fmap(sym)
m = binding.of_caller(1).method(sym)
[].tap do |r|
each do |e|
r << m.(e)
end
end
end
end
if __FILE__ == $0
def add3(x)
x + 3
end
puts ["hello", "world"].my_map(:upcase)
puts [1,2].fmap(:add3)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.