Created
November 18, 2011 17:40
-
-
Save scottjacobsen/1377158 to your computer and use it in GitHub Desktop.
include include
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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