Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
include include
ruby-1.9.3-rc1 :001 > module Foo
ruby-1.9.3-rc1 :002?> def im_foo; "foo"; end;
ruby-1.9.3-rc1 :003 > end
=> nil
ruby-1.9.3-rc1 :004 > module Bar
ruby-1.9.3-rc1 :005?> include Foo
ruby-1.9.3-rc1 :006?> def im_bar; "bar"; end;
ruby-1.9.3-rc1 :007 > end
=> nil
ruby-1.9.3-rc1 :008 > class FooBar
ruby-1.9.3-rc1 :009?> include Bar
ruby-1.9.3-rc1 :010?> end
=> FooBar
ruby-1.9.3-rc1 :011 > FooBar.new.im_bar
=> "bar"
ruby-1.9.3-rc1 :012 > FooBar.new.im_foo
=> "foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment