Skip to content

Instantly share code, notes, and snippets.

@stevehorn
Created January 18, 2011 16:05
Show Gist options
  • Save stevehorn/784641 to your computer and use it in GitHub Desktop.
Save stevehorn/784641 to your computer and use it in GitHub Desktop.
instance_eval vs. class_eval
String.instance_eval {
def pie
"mmmm"
end
}
puts String.pie
String.class_eval {
def cake
"ewwww"
end
}
st = "Pants"
puts st.cake
# mmmm
# ewwww
@mgroves
Copy link

mgroves commented Jan 18, 2011

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment