Class: TempestTime::Setting
- Inherits:
-
Object
- Object
- TempestTime::Setting
show all
- Defined in:
- lib/tempest_time/setting.rb
Class Method Summary
collapse
Class Method Details
.contents ⇒ Object
6
7
8
9
10
|
# File 'lib/tempest_time/setting.rb', line 6
def contents
file.map do |key, value|
{ key => value }
end
end
|
.delete(key) ⇒ Object
26
27
28
29
|
# File 'lib/tempest_time/setting.rb', line 26
def delete(key)
temp = file.tap { |f| f.delete(key) }
File.open(file_path, 'w') { |f| f.write temp.to_yaml }
end
|
.keys ⇒ Object
16
17
18
|
# File 'lib/tempest_time/setting.rb', line 16
def keys
file.keys&.sort || []
end
|
.read(key) ⇒ Object
12
13
14
|
# File 'lib/tempest_time/setting.rb', line 12
def read(key)
file[key]
end
|
.update(key, value) ⇒ Object
20
21
22
23
24
|
# File 'lib/tempest_time/setting.rb', line 20
def update(key, value)
temp = file
temp[key] = value
File.open(file_path, 'w') { |f| f.write temp.to_yaml }
end
|