-
-
Save headius/d2e04a0580deffa415fc 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 Foo | |
def define(name, &block) | |
class << self; self; end.send(:define_method, name, block) | |
end | |
def define2(name, &block) | |
define(name, &block) | |
end | |
def test | |
define(:foo) { return 1 } | |
call_foo | |
puts :here | |
end | |
def call_foo | |
foo | |
end | |
end | |
Foo.new.test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment