Class: Knapsack::Report
- Inherits:
-
Object
- Object
- Knapsack::Report
- Includes:
- Singleton
- Defined in:
- lib/knapsack/report.rb
Instance Method Summary collapse
Instance Method Details
#config(opts = {}) ⇒ Object
5 6 7 8 |
# File 'lib/knapsack/report.rb', line 5 def config(opts={}) @config ||= default_config @config.merge!(opts) end |
#open ⇒ Object
16 17 18 19 20 21 |
# File 'lib/knapsack/report.rb', line 16 def open report = File.read(config[:report_path]) JSON.parse(report) rescue Errno::ENOENT raise "Knapsack report file doesn't exist. Please generate report first!" end |
#save ⇒ Object
10 11 12 13 14 |
# File 'lib/knapsack/report.rb', line 10 def save File.open(config[:report_path], 'w+') do |f| f.write(report_json) end end |