Skip to content

Instantly share code, notes, and snippets.

@jswanner
Created June 25, 2013 23:36
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 jswanner/5863448 to your computer and use it in GitHub Desktop.
Save jswanner/5863448 to your computer and use it in GitHub Desktop.
Including multiple modules into class
$ 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