Created
July 26, 2015 20:44
-
-
Save scaint/dd3a868629401ba62c80 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
public.class_eval { def say_hello; 'Hello!'; end } | |
:ruby.say_hello # => "Hello!" |
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
public.class.class_eval { public :define_method } # First we need to change visibility of define_method() :) | |
public.define_method(:say_hello) { 'Hello' } | |
nil.say_hello # => 'Hello!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment