Skip to content

Instantly share code, notes, and snippets.

@DylanFM
Created January 21, 2009 04:15
Show Gist options
  • Save DylanFM/49850 to your computer and use it in GitHub Desktop.
Save DylanFM/49850 to your computer and use it in GitHub Desktop.
def fun(cl,name,&body)
cl.class_eval {
define_method(name,body)
}
end
fun String,:world do
"#{self} world"
end
p "Hello".world
# =>
# >> "Hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment