Module: SubstAttr

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

Defined Under Namespace

Modules: Attribute, Controls, Macro, Substitute

Class Method Summary collapse

Class Method Details

.activate(target_class = nil) ⇒ Object



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

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

  return if target_class.ancestors.include? SubstAttr::Macro

  target_class.extend SubstAttr::Macro
end

.extended(cls) ⇒ Object



8
9
10
11
12
# File 'lib/subst_attr/subst_attr.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/subst_attr/subst_attr.rb', line 2

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