Skip to content

Instantly share code, notes, and snippets.

@tmm1
Forked from jnunemaker/gist:412580
Created May 25, 2010 00:21
Show Gist options
  • Save tmm1/412597 to your computer and use it in GitHub Desktop.
Save tmm1/412597 to your computer and use it in GitHub Desktop.
# What is the best way to get it to put out a, b, c
# without erroring about the superclass. The module
# inclusion order should not matter. In other words,
# I should be able to include A then B or B then A
# and either way all the letters a, b, and c are
# printed out (though not necessarily in that exact order)
module A
def foo
super
puts 'a'
end
end
module B
def foo
super
puts 'b'
end
end
class C
module InstanceMethods
def foo
puts 'c'
end
end
include InstanceMethods
include A
include B
end
C.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment