Created
February 15, 2010 16:19
-
-
Save workmad3/304760 to your computer and use it in GitHub Desktop.
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.8.7-p248 > module Foo | |
ruby-1.8.7-p248 ?> def self.included(base) | |
ruby-1.8.7-p248 ?> def base.do_foo | |
ruby-1.8.7-p248 ?> define_method :write do | |
ruby-1.8.7-p248 > puts "1" | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
=> nil | |
ruby-1.8.7-p248 > module Bar | |
ruby-1.8.7-p248 ?> def self.included(base) | |
ruby-1.8.7-p248 ?> def base.do_bar | |
ruby-1.8.7-p248 ?> define_method :write do | |
ruby-1.8.7-p248 > puts "2" | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
ruby-1.8.7-p248 ?> end | |
=> nil | |
ruby-1.8.7-p248 > class Thing | |
ruby-1.8.7-p248 ?> include Foo | |
ruby-1.8.7-p248 ?> do_foo | |
ruby-1.8.7-p248 ?> include Bar | |
ruby-1.8.7-p248 ?> do_bar | |
ruby-1.8.7-p248 ?> end | |
=> #<Proc:0x0014fd34@(irb):16> | |
ruby-1.8.7-p248 > Thing.new.write | |
2 | |
=> nil | |
ruby-1.8.7-p248 > class Thang | |
ruby-1.8.7-p248 ?> include Bar | |
ruby-1.8.7-p248 ?> do_bar | |
ruby-1.8.7-p248 ?> include Foo | |
ruby-1.8.7-p248 ?> do_foo | |
ruby-1.8.7-p248 ?> end | |
=> #<Proc:0x0015b404@(irb):7> | |
ruby-1.8.7-p248 > Thang.new.write | |
1 | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment