Skip to content

Instantly share code, notes, and snippets.

@stevenbristol
Created August 1, 2012 12:52
Show Gist options
  • Save stevenbristol/3226615 to your computer and use it in GitHub Desktop.
Save stevenbristol/3226615 to your computer and use it in GitHub Desktop.
instance_eval and class_eval 2
"string2".instance_eval { p self } # => "string2"
begin
"string2".class_eval { p self }
rescue Exception => e
p e # => #<NoMethodError: undefined method `class_eval' for "string2":String>
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment