Method: LibyearBundler::Reports::Base#to_h

Defined in:
lib/libyear_bundler/reports/base.rb

#to_hObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/libyear_bundler/reports/base.rb', line 20

def to_h
  @_to_h ||=
    begin
      gems = sorted_gems(@gems)
      summary = {
        gems: gems,
        sum_libyears: 0.0
      }
      gems.each { |gem| increment_metrics_summary(gem, summary) }

      begin
        increment_metrics_summary(@ruby, summary) if @ruby.outdated?
      rescue StandardError => e
        warn "Unable to calculate libyears for ruby itself: #{e}"
      end

      summary
    end
end