Created
July 29, 2014 16:16
-
-
Save anonymous/28e2323b33b8e589457c 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
#!/usr/bin/env ruby | |
module M | |
refine NilClass do # !> Refinements are experimental, and the behavior may change in future versions of Ruby! | |
def magic | |
"some magic stuff is happening" | |
end | |
end | |
end | |
class Hohooo | |
end | |
howdy = Hohooo.new # => #<Hohooo:0x007fc55210c4c0> | |
howdy.instance_eval("using M\nnil.magic") # => | |
# ~> -:18:in `instance_eval': undefined method `using' for #<Hohooo:0x007f98ac21c4f0> (NoMethodError) | |
# ~> from -:18:in `instance_eval' | |
# ~> from -:18:in `<main>' | |
eval("using M\nnil.magic") # => "some magic stuff is happening" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment