class Confuse::Namespace
A {Namespace} is a container to keep configuration data seperate from the rest of the config.
Attributes
items[R]
Public Class Methods
new(name, &block)
click to toggle source
# File lib/confuse/namespace.rb, line 9 def initialize(name, &block) @name = name @items = {} block.call(self) if block_given? end
Public Instance Methods
[](key)
click to toggle source
# File lib/confuse/namespace.rb, line 19 def [](key) @items[key] end
add_item(name, opts = {})
click to toggle source
# File lib/confuse/namespace.rb, line 15 def add_item(name, opts = {}) @items[name] = Item.new(name, opts) end
to_hash()
click to toggle source
# File lib/confuse/namespace.rb, line 23 def to_hash @items.reduce({}) do |a, (k,v)| key = @name ? :"#{@name}_#{k}" : k a.merge({ key => v.to_hash }) end end