Module: Configure
- Included in:
- Controls::Example, Controls::Extended::Example, Controls::KeywordArgument::Example, Controls::KeywordArgument::Optional::Example, Controls::PositionalArgument::Example, Controls::PositionalArgument::Optional::Example
- Defined in:
- lib/configure/macro.rb,
lib/configure/activate.rb,
lib/configure/configure.rb,
lib/configure/controls/example.rb,
lib/configure/controls/extended.rb,
lib/configure/controls/included.rb,
lib/configure/controls/no_arguments.rb,
lib/configure/controls/factory_method.rb,
lib/configure/controls/keyword_argument.rb,
lib/configure/controls/positional_argument.rb
Defined Under Namespace
Class Method Summary collapse
- .activate(target_class = nil, factory_method: nil, constructor: nil) ⇒ Object
- .extended(cls) ⇒ Object
- .included(cls) ⇒ Object
Class Method Details
.activate(target_class = nil, factory_method: nil, constructor: nil) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/configure/activate.rb', line 2 def self.activate(target_class=nil, factory_method: nil, constructor: nil) target_class ||= Object unless constructor.nil? factory_method = constructor end macro_module = Configure::Macro return if target_class.is_a?(macro_module) target_class.extend(macro_module) target_class.default_factory_method = factory_method end |
.extended(cls) ⇒ Object
8 9 10 11 12 |
# File 'lib/configure/configure.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/configure/configure.rb', line 2 def self.included(cls) cls.class_exec do extend Macro end end |