Skip to content

Instantly share code, notes, and snippets.

@jarrettmeyer
Last active December 16, 2015 01:29
Show Gist options
  • Select an option

  • Save jarrettmeyer/5355188 to your computer and use it in GitHub Desktop.

Select an option

Save jarrettmeyer/5355188 to your computer and use it in GitHub Desktop.
Ruby mixin behavior
module A
def do_something
puts "In A"
end
end
module B
def do_something_else
puts "In B"
end
end
class MyClass
include A
include B
def do_something
puts "In MyClass"
end
end
a = MyClass.new
def a.do_something
puts "in local instance"
end
a.do_something
# => in local instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment