Created
December 13, 2015 19:28
-
-
Save stoffie/6e6d0f82b70bf4a81758 to your computer and use it in GitHub Desktop.
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
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