lib/ultra_config/namespace.rb in ultra_config-0.6.1 vs lib/ultra_config/namespace.rb in ultra_config-0.7.0
- old
+ new
@@ -1,26 +1,27 @@
require_relative 'config'
module UltraConfig
class Namespace
def initialize(&block)
- @configuration = block
+ @configuration = [block]
reset
end
+ def extend(&block)
+ @configuration << block
+ self.instance_eval(&block)
+ end
+
def setting(name, value)
Settings.set(name, value)
end
def namespace(name, &block)
@objects[name] = Namespace.new(&block)
end
- def constants(constants)
- @constants ||= constants
- end
-
def config(name, default = nil, &block)
@objects[name] = Config.new(default, &block)
end
def helper(name, &block)
@@ -35,10 +36,10 @@
end
end
def reset
@objects = {}
- self.instance_eval(&@configuration)
+ @configuration.each { |config| self.instance_eval(&config) }
end
def to_s
objs = []
\ No newline at end of file