Class: Ironment::Config

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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.config_pathObject



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

def config_path
  @config_path || default_config_path
end

Class Method Details

.default_config_pathObject



21
22
23
# File 'lib/ironment/config.rb', line 21

def default_config_path
  File.join(Dir.home, ".config", "ironment", "config")
end

Instance Method Details

#[](key) ⇒ Object



26
27
28
# File 'lib/ironment/config.rb', line 26

def [](key)
  read_pairs[key]
end

#[]=(key, value) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/ironment/config.rb', line 30

def []=(key, value)
  if value.nil?
    write_pairs read_pairs.except(key)
  else
    write_pairs read_pairs.merge(key => value)
  end
end