lib/ruby-conf.rb in ruby-conf-1.3.0 vs lib/ruby-conf.rb in ruby-conf-1.4.0

- old
+ new

@@ -7,10 +7,14 @@ class Config def initialize @attributes = {} end + def [](name) + @attributes[name.to_sym] + end + def method_missing(name, *args, &block) case(args.size) when 0: if block_given? @attributes[name.to_sym] = RubyConf.define(&block) @@ -63,9 +67,13 @@ @@configs[name.to_sym] = config unless name.nil? if options.has_key? :as Object.const_set(options[:as].to_s.to_sym, config) end config + end + + def self.[](name) + @@configs[name.to_sym] end def self.method_missing(name, *args, &block) if @@configs.has_key? name.to_sym @@configs[name.to_sym]