Module: Yogo::ExtensionModule

Defined in:
lib/yogo/support/extension_module.rb

Instance Method Summary collapse

Instance Method Details

#class_extensions(&block) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/yogo/support/extension_module.rb', line 25

def class_extensions(&block)
  @_class_extensions ||= lambda {}
  if block_given?
    @_class_extensions = block
  end
  @_class_extensions
end

#extended(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/yogo/support/extension_module.rb', line 4

def extended(base)
  case(base)
  when Class, Module
    base.class_eval(&class_extensions)
  else
    base.instance_eval(&instance_extensions)
  end
end

#included(base) ⇒ Object



13
14
15
# File 'lib/yogo/support/extension_module.rb', line 13

def included(base)
  extended(base)
end

#instance_extensions(&block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/yogo/support/extension_module.rb', line 17

def instance_extensions(&block)
  @_instance_extensions ||= lambda {}
  if block_given?
    @_instance_extensions = block
  end
  @_instance_extensions
end