Created
October 1, 2020 20:16
-
-
Save kalmanh/d1e06328164c7b34083f1cbed1726ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 DynamicallyDefineAndCall | |
def method_missing(method, *args) | |
puts method | |
self.class.send(:define_method, method) do | |
puts 'take it easy now' | |
end | |
send method | |
end | |
end | |
test = DynamicallyDefineAndCall.new | |
test.going_bananas | |
test.going_bananas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment