lib/korben/kc_config.rb in korben-0.0.1 vs lib/korben/kc_config.rb in korben-0.0.2
- old
+ new
@@ -28,32 +28,29 @@
def initialize
@settings = {}
end
def load!(settings = {})
- settings.each do |key, value|
- set(key, value)
- end
+ settings.each { |key, value| set(key, value) }
end
def set(key, value)
- unset(key) if set?(key)
define_accessor(key) { value }
@settings[key] = value
end
- def set?(key)
+ def exist?(key)
@settings.key?(key)
end
def get(key)
@settings[key]
end
private
def define_accessor(name, &block)
- singleton_class.class_eval { define_method(name, &block) } if !respond_to?(name) || exists?(name)
+ singleton_class.class_eval { define_method(name, &block) } if !respond_to?(name) || exist?(name)
end
def singleton_class
class << self
self