Skip to content

Instantly share code, notes, and snippets.

@mehlah
Created November 29, 2015 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehlah/c61964ec34a272c36af9 to your computer and use it in GitHub Desktop.
Save mehlah/c61964ec34a272c36af9 to your computer and use it in GitHub Desktop.
module Human
def hello
p 'Hello'
end
end
class Cat
include Human
def mew
p 'moeeew'
end
end
class Dog
def bark
p 'waaaaf'
end
define_method :hello, Human.instance_method(:hello)
#define_method :hello, Cat.instance_method(:hello)
end
Dog.new.hello
#=> 'Hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment