Skip to content

Instantly share code, notes, and snippets.

@advishnuprasad
Created March 13, 2013 06:38
Show Gist options
  • Save advishnuprasad/5149814 to your computer and use it in GitHub Desktop.
Save advishnuprasad/5149814 to your computer and use it in GitHub Desktop.
o = Object.new
# class_eval example
class << o; self; end.class_eval { def test1; :test1; end }
o.test1 #=> test1
# instance_eval example
class << o; self; end.instance_eval { def test2; :test2; end }
o.test2 #=> NoMethodError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment