Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created June 28, 2012 11:56
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 workmad3/3010924 to your computer and use it in GitHub Desktop.
Save workmad3/3010924 to your computer and use it in GitHub Desktop.
class C
include A
include B
end
C.new.foo #will call B.foo, then A.foo - method composition
module A
def foo
super if defined?(super)
do_stuff()
end
end
module B
def foo
do_other_stuff
super if defined?(super)
do_some_more_stuff
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment