Last active
December 17, 2016 03:42
-
-
Save replaid/01cb178551957fde5f6a9a15d284d219 to your computer and use it in GitHub Desktop.
Included Ruby modules go into the inheritance chain
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(main):001:0> module Mixin; end | |
=> nil | |
irb(main):002:0> class A | |
irb(main):003:1> include Mixin | |
irb(main):004:1> end | |
=> A | |
irb(main):005:0> a = A.new | |
=> #<A:0x007fbaea8a89a8> | |
irb(main):006:0> a.is_a? Mixin | |
=> true | |
irb(main):007:0> a.class.ancestors | |
=> [A, Mixin, Object, Kernel, BasicObject] | |
irb(main):008:0> a.is_a? Mixin | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment