class Stringex::Configuration::Configurator

Attributes

klass[RW]

Public Class Methods

new(klass) click to toggle source
# 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

Public Instance Methods

define_instance_method_for_configuration_wrapper(name) click to toggle source
# 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