Skip to content

Instantly share code, notes, and snippets.

@kalmanh
Created October 1, 2020 20:16
Show Gist options
  • Save kalmanh/d1e06328164c7b34083f1cbed1726ed5 to your computer and use it in GitHub Desktop.
Save kalmanh/d1e06328164c7b34083f1cbed1726ed5 to your computer and use it in GitHub Desktop.
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