Class: TempestTime::Setting
- Inherits:
-
Object
- Object
- TempestTime::Setting
show all
- Defined in:
- lib/tempest_time/setting.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
7
8
9
10
11
|
# File 'lib/tempest_time/setting.rb', line 7
def initialize
@config = TTY::Config.new
config.extname = '.yml'
config.append_path(Dir.home + '/.tempest')
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5
6
7
|
# File 'lib/tempest_time/setting.rb', line 5
def config
@config
end
|
Instance Method Details
#append(key, value) ⇒ Object
33
34
35
|
# File 'lib/tempest_time/setting.rb', line 33
def append(key, value)
write_config { config.append(value, to: key) }
end
|
#delete(key) ⇒ Object
21
22
23
|
# File 'lib/tempest_time/setting.rb', line 21
def delete(key)
write_config { config.delete(key) }
end
|
#fetch(key) ⇒ Object
17
18
19
|
# File 'lib/tempest_time/setting.rb', line 17
def fetch(key)
read_config { config.fetch(key) }
end
|
#keys ⇒ Object
13
14
15
|
# File 'lib/tempest_time/setting.rb', line 13
def keys
read_config { config.to_h.keys }
end
|
#remove(key, value) ⇒ Object
29
30
31
|
# File 'lib/tempest_time/setting.rb', line 29
def remove(key, value)
write_config { config.remove(value, from: key) }
end
|
#set(key, value) ⇒ Object
25
26
27
|
# File 'lib/tempest_time/setting.rb', line 25
def set(key, value)
write_config { config.set(key, value: value) }
end
|