Skip to content

Instantly share code, notes, and snippets.

@stoffie
Created December 13, 2015 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoffie/6e6d0f82b70bf4a81758 to your computer and use it in GitHub Desktop.
Save stoffie/6e6d0f82b70bf4a81758 to your computer and use it in GitHub Desktop.
class Object
def my_method(sym)
MyMethod.new(self, sym)
end
end
class MyMethod
def initialize(obj, method)
@obj, @method = obj, method
end
def call(*args, &block)
@obj.send(@method, *args, &block)
end
end
p "stack overflow".my_method(:length).()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment