Created
June 25, 2013 23:36
-
-
Save jswanner/5863448 to your computer and use it in GitHub Desktop.
Including multiple modules into class
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
$ irb | |
irb(main):001:0> module Mod1 | |
irb(main):002:1> def self.included base | |
irb(main):003:2> puts 'included Mod1' | |
irb(main):004:2> end | |
irb(main):005:1> end | |
=> nil | |
irb(main):006:0> module Mod2 | |
irb(main):007:1> def self.included base | |
irb(main):008:2> puts 'included Mod2' | |
irb(main):009:2> end | |
irb(main):010:1> end | |
=> nil | |
irb(main):011:0> class Cls1 | |
irb(main):012:1> include Mod1, Mod2 | |
irb(main):013:1> end | |
included Mod2 | |
included Mod1 | |
=> Cls1 | |
irb(main):014:0> class Cls2 | |
irb(main):015:1> include Mod1 | |
irb(main):016:1> include Mod2 | |
irb(main):017:1> end | |
included Mod1 | |
included Mod2 | |
=> Cls2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment