Module: Dependency

Included in:
Controls::Example, Controls::Extended::Example
Defined in:
lib/dependency/macro.rb,
lib/dependency/activate.rb,
lib/dependency/attribute.rb,
lib/dependency/dependency.rb,
lib/dependency/substitute.rb,
lib/dependency/controls/example.rb,
lib/dependency/controls/extended.rb,
lib/dependency/controls/included.rb,
lib/dependency/controls/dependency.rb

Defined Under Namespace

Modules: Attribute, Controls, Macro

Constant Summary collapse

Substitute =
SubstAttr::Substitute

Class Method Summary collapse

Class Method Details

.activate(target_class = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/dependency/activate.rb', line 2

def self.activate(target_class=nil)
  target_class ||= Object

  macro_module = Dependency::Macro

  return if target_class.is_a? macro_module

  target_class.extend(macro_module)
end

.extended(cls) ⇒ Object



8
9
10
11
12
# File 'lib/dependency/dependency.rb', line 8

def self.extended(cls)
  cls.class_exec do
    extend Macro
  end
end

.included(cls) ⇒ Object



2
3
4
5
6
# File 'lib/dependency/dependency.rb', line 2

def self.included(cls)
  cls.class_exec do
    extend Macro
  end
end