Module: Hyhyhy::Config
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
21 22 23 |
# File 'lib/hyhyhy/config.rb', line 21 def [](key) all[key] end |
#[]=(key, value) ⇒ Object
25 26 27 28 29 |
# File 'lib/hyhyhy/config.rb', line 25 def []=(key, value) all[key] = value File.open(@filename, 'w') { |f| f.write(JSON.pretty_generate(@settings)) } end |
#all ⇒ Object
17 18 19 |
# File 'lib/hyhyhy/config.rb', line 17 def all @settings end |
#load(filename) ⇒ Object
12 13 14 15 |
# File 'lib/hyhyhy/config.rb', line 12 def load(filename) @filename = filename @settings = JSON.parse(File.read(@filename)) end |