Module: Exportify::Config
- Defined in:
- lib/exportify/config.rb
Constant Summary collapse
- CONFIG_PATH =
File.('~/.exportify')
Class Method Summary collapse
Class Method Details
.load ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/exportify/config.rb', line 11 def load return {} unless File.exist?(CONFIG_PATH) JSON.parse(File.read(CONFIG_PATH)) rescue JSON::ParserError {} end |
.output_dir ⇒ Object
24 25 26 |
# File 'lib/exportify/config.rb', line 24 def output_dir load['output_dir'] || CLI::DEFAULT_OUTPUT_DIR end |
.save(data) ⇒ Object
19 20 21 22 |
# File 'lib/exportify/config.rb', line 19 def save(data) File.write(CONFIG_PATH, JSON.pretty_generate(load.merge(data))) File.chmod(0o600, CONFIG_PATH) end |