Class: Perfer::SessionFormatter
- Inherits:
-
Object
- Object
- Perfer::SessionFormatter
- Includes:
- Formatter
- Defined in:
- lib/perfer/formatter/session_formatter.rb
Constant Summary
Constants included from Formatter
Instance Method Summary collapse
-
#initialize(session) ⇒ SessionFormatter
constructor
A new instance of SessionFormatter.
- #report(options = {}) ⇒ Object
Methods included from Formatter
#float_scale, #format_duration, #format_duration_and_error, #format_error, #format_float, #format_ips, #format_n, #format_time, #max_length_of, #ruby_version, #short_ruby_description
Constructor Details
#initialize(session) ⇒ SessionFormatter
Returns a new instance of SessionFormatter.
5 6 7 |
# File 'lib/perfer/formatter/session_formatter.rb', line 5 def initialize(session) @session = session end |
Instance Method Details
#report(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/perfer/formatter/session_formatter.rb', line 9 def report( = {}) return puts "No results available." unless @session.results session_name = @session.results.first[:session] puts session_name last_bench_file_checksum = @session.results.first[:bench_file_checksum] @session.results.chunk { |r| r[:run_time] }.each { |run_time, results| result = results.first if last_bench_file_checksum != result[:bench_file_checksum] puts "-- The benchmark script changed --" puts last_bench_file_checksum = result[:bench_file_checksum] end puts "Ran at #{format_time run_time} with #{result[:ruby]}" ResultsFormatter.new(results).report() puts } end |