Skip to content

Instantly share code, notes, and snippets.

@josemarluedke
Created March 13, 2012 22:21
Show Gist options
  • Save josemarluedke/2032161 to your computer and use it in GitHub Desktop.
Save josemarluedke/2032161 to your computer and use it in GitHub Desktop.
Crie o método add_hello que recebe uma classe e define o método hello nessa.
require 'metaid'
class Person
end
def add_hello klass
klass.send :meta_def, :hello, do
"Hello!"
end
end
add_hello Person
puts Person.hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment