Class: Stringex::Configuration::Configurator
- Inherits:
-
Object
- Object
- Stringex::Configuration::Configurator
- Defined in:
- lib/stringex/configuration/configurator.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
- #define_instance_method_for_configuration_wrapper(name) ⇒ Object
-
#initialize(klass) ⇒ Configurator
constructor
A new instance of Configurator.
Constructor Details
#initialize(klass) ⇒ Configurator
Returns a new instance of Configurator.
6 7 8 9 10 11 12 |
# File 'lib/stringex/configuration/configurator.rb', line 6 def initialize(klass) @klass = klass self.klass.valid_configuration_details.each do |name| define_instance_method_for_configuration_wrapper name end end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
4 5 6 |
# File 'lib/stringex/configuration/configurator.rb', line 4 def klass @klass end |
Instance Method Details
#define_instance_method_for_configuration_wrapper(name) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/stringex/configuration/configurator.rb', line 14 def define_instance_method_for_configuration_wrapper(name) name = name.respond_to?(:intern) ? name.intern : name (class << self; self; end).instance_eval do define_method("#{name}=") do |value| customizations = klass.send(:system_wide_customizations) customizations[name] = value end end end |