Skip to content

Instantly share code, notes, and snippets.

@scottjacobsen
Created November 18, 2011 17:40
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 scottjacobsen/1377158 to your computer and use it in GitHub Desktop.
Save scottjacobsen/1377158 to your computer and use it in GitHub Desktop.
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