Sha256: 7f173361809ebbb305284e10db9f52f95c93d187fec2da06381a3ef945e39ef5

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

module ApplicationConfig
	class Base
		@@application_config = nil
  
    def [](key)
      return @config[key] if @config
      nil
    end
  
    def add(config_text)
      if @config
        @config.merge!(YAML::load(config_text))
      else
        @config = ApplicationConfig::DataStructures::NestedHash.new(YAML::load(config_text))
      end
    end
  
    def self.singleton(application_config)
      @@application_config ||= application_config
    end
  
    def self.[](key)
      @@application_config[key]
    end
    
    def method_missing(method_name)
      self[method_name.to_s]
    end
    
    def self.method_missing(method_name)
      self[method_name.to_s]
    end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
application_config-0.0.2 lib/application_config/base.rb