Class: Nutella::ConfigHash

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

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ ConfigHash

Returns a new instance of ConfigHash.



9
10
11
# File 'lib/config/config.rb', line 9

def initialize(file)
  @config_file=file
end

Instance Method Details

#[](key) ⇒ Object



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

def [](key)
  hash = loadConfig
  hash[key]
end

#[]=(key, val) ⇒ Object



14
15
16
17
18
# File 'lib/config/config.rb', line 14

def []=(key,val)
  hash = loadConfig
  hash[key]=val
  storeConfig hash
end

#empty?Boolean

Returns:



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

def empty?
  hash = loadConfig
  hash.empty?
end

#has_key?(key) ⇒ Boolean

Returns:



30
31
32
33
# File 'lib/config/config.rb', line 30

def has_key?(key)
  hash = loadConfig
  hash.has_key? key
end

#to_hObject



40
41
42
43
# File 'lib/config/config.rb', line 40

def to_h
  hash = loadConfig
  hash
end

#to_sObject



35
36
37
38
# File 'lib/config/config.rb', line 35

def to_s
  hash = loadConfig
  hash.to_s
end