Sha256: 3fb8badfb69564d10c3478d39c24b3c2988d7073452a4cabea1c825eea5bc5ea
Contents?: true
Size: 864 Bytes
Versions: 1
Compression:
Stored size: 864 Bytes
Contents
module Config module Factory class Environment attr_reader :name def initialize(name:, configs:) self.name = name self.configs = configs end def args_for(config_name) config_name = config_name.to_s unless config_name.is_a?(String) @configs[config_name] end def self.load_file(path) hash = YAML.load_file(path) load_hash(hash) end def self.load_hash(hash) Environment.new(name: Environments::DEFAULT_ENVIRONMENT, configs: hash) end private def name=(v) fail ArgumentError, 'Environment name must be a symbol' unless v && v.is_a?(Symbol) @name = v end def configs=(v) fail ArgumentError, 'Configs must be a hash' unless v && v.respond_to?(:[]) @configs = v end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
config-factory-0.0.2 | lib/config/factory/environment.rb |