Sha256: a9621f0e4f287899fc86992ca43613ee94d40dc602665ad641433c6e0fb7ef1a
Contents?: true
Size: 639 Bytes
Versions: 1
Compression:
Stored size: 639 Bytes
Contents
require_relative 'config' module UltraConfig class Namespace def initialize(&block) @objects = {} self.instance_eval(&block) end def namespace(name, &block) @objects[name] = Namespace.new(&block) end def config(name, default = nil, &block) @objects[name] = Config.new(default, &block) end def method_missing(m, *args) if m.to_s.end_with?('=') @objects[m.to_s[0...-1].to_sym].value=(args[0]) else @objects[m].is_a?(Config) ? @objects[m].value : @objects[m] end end def setting(name, value) Settings.set(name, value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ultra_config-0.1.0 | lib/ultra_config/namespace.rb |