class Stealth::Configuration
Public Class Methods
new(hash)
click to toggle source
# File lib/stealth/configuration.rb, line 9 def initialize(hash) hash.each do |k, v| self[k] = store(v) end self end
Public Instance Methods
method_missing(method, *args)
click to toggle source
Calls superclass method
# File lib/stealth/configuration.rb, line 17 def method_missing(method, *args) key = create_config_attribute(method) if setter?(method) self[key] = args.first else super(method, args) && return unless key?(key) self[key] end end
Private Instance Methods
basic_config_attribute_from_method(method)
click to toggle source
# File lib/stealth/configuration.rb, line 48 def basic_config_attribute_from_method(method) setter?(method) ? method.to_s.chop : method end
create_config_attribute(method)
click to toggle source
# File lib/stealth/configuration.rb, line 42 def create_config_attribute(method) key = basic_config_attribute_from_method(method) key?(key.to_s) ? key.to_s : key end
setter?(method)
click to toggle source
# File lib/stealth/configuration.rb, line 38 def setter?(method) method.slice(-1, 1) == "=" end
store(value)
click to toggle source
# File lib/stealth/configuration.rb, line 30 def store(value) if value.is_a?(Hash) Stealth::Configuration.new(value) else value end end