Class: Evm::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/evm/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(config_file, defaults = {}) ⇒ Config

Returns a new instance of Config.



5
6
7
8
# File 'lib/evm/config.rb', line 5

def initialize(config_file, defaults = {})
  @config_file = config_file
  @defaults = defaults
end

Instance Method Details

#[](type) ⇒ Object



10
11
12
13
14
15
# File 'lib/evm/config.rb', line 10

def [](type)
  config[type.to_s] || begin
    default = @defaults.find { |key, value| key.to_s == type.to_s }
    default[1] if default
  end
end

#[]=(type, value) ⇒ Object



17
18
19
# File 'lib/evm/config.rb', line 17

def []=(type, value)
  write(config.merge(type.to_s => value))
end