Skip to content

Instantly share code, notes, and snippets.

@replaid
Last active December 17, 2016 03:42
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 replaid/01cb178551957fde5f6a9a15d284d219 to your computer and use it in GitHub Desktop.
Save replaid/01cb178551957fde5f6a9a15d284d219 to your computer and use it in GitHub Desktop.
Included Ruby modules go into the inheritance chain
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