Class: RailsStats::JSONFormatter

Inherits:
StatsFormatter show all
Defined in:
lib/rails_stats/json_formatter.rb

Instance Attribute Summary

Attributes inherited from StatsFormatter

#calculator

Instance Method Summary collapse

Methods inherited from StatsFormatter

#initialize

Constructor Details

This class inherits a constructor from RailsStats::StatsFormatter

Instance Method Details

#resultObject



5
6
7
8
9
10
11
12
13
# File 'lib/rails_stats/json_formatter.rb', line 5

def result
  @result = @statistics.map { |key, stats| stat_hash(key, stats) }

  if @grand_total
    @result << stat_hash("Total", @grand_total).merge(code_test_hash)
  end

  @result
end

#to_sObject



15
16
17
# File 'lib/rails_stats/json_formatter.rb', line 15

def to_s
  puts result.to_json
end