Class: LibyearBundler::Reports::JSON
- Defined in:
- lib/libyear_bundler/reports/json.rb
Overview
Responsible for generating data from the ‘::LibyearBundler::Models` in JSON format. Should only be concerned with presentation, nothing else.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from LibyearBundler::Reports::Base
Instance Method Details
#write ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/libyear_bundler/reports/json.rb', line 9 def write data = { gems: to_h[:gems].map { |gem| gem_info(gem) }, ruby: gem_info(@ruby) } data[:sum_libyears] = to_h[:sum_libyears].round(1) if @options.libyears? data[:sum_seq_delta] = to_h[:sum_seq_delta].round(1) if @options.releases? if @options.versions? data[:sum_major_version] = to_h[:sum_major_version].round(1) data[:sum_minor_version] = to_h[:sum_minor_version].round(1) data[:sum_patch_version] = to_h[:sum_patch_version].round(1) end @io.puts ::JSON.pretty_generate(data) end |