Module: FunWith::Gems::Inclusionizer::SelfIncludedMethod

Defined in:
lib/fun_with/gems/inclusionizer.rb

Instance Method Summary collapse

Instance Method Details

#included(base) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fun_with/gems/inclusionizer.rb', line 14

def included( base )
  __self = self

  if base.is_a?(Module)
    base.module_eval do
      extend  __self::ClassMethods     if defined?( __self::ClassMethods )
      include __self::InstanceMethods  if defined?( __self::InstanceMethods )
      include __self::Constants        if defined?( __self::Constants )
    end
  elsif base.is_a?(Class)
    base.class_eval do
      extend  __self::ClassMethods     if defined?( __self::ClassMethods )
      include __self::InstanceMethods  if defined?( __self::InstanceMethods )
      include __self::Constants        if defined?( __self::Constants )
    end
  end
end