Module: Nehm::Cfg
- Defined in:
- lib/nehm/cfg.rb
Overview
Cfg module manipulates with nehm’s config file (~/.nehmconfig)
Constant Summary collapse
- FILE_PATH =
File.join(ENV['HOME'], '.nehmconfig')
- CONFIG_FILE =
Bogy.new(file: FILE_PATH)
Class Method Summary collapse
Class Method Details
.[](key) ⇒ Object
10 11 12 |
# File 'lib/nehm/cfg.rb', line 10 def self.[](key) CONFIG_FILE[key.to_s] end |
.[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/nehm/cfg.rb', line 14 def self.[]=(key, value) CONFIG_FILE[key.to_s] = value end |
.create ⇒ Object
18 19 20 |
# File 'lib/nehm/cfg.rb', line 18 def self.create File.open(FILE_PATH, 'w+') { |f| f.write("---\napp: nehm") } end |
.exist? ⇒ Boolean
22 23 24 |
# File 'lib/nehm/cfg.rb', line 22 def self.exist? File.exist?(FILE_PATH) end |
.key?(key) ⇒ Boolean
26 27 28 |
# File 'lib/nehm/cfg.rb', line 26 def self.key?(key) CONFIG_FILE.to_h.key?(key.to_s) end |