Class: Benchmark::Memory::Job::IOOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/benchmark/memory/job/io_output.rb,
lib/benchmark/memory/job/io_output/entry_formatter.rb,
lib/benchmark/memory/job/io_output/metric_formatter.rb,
lib/benchmark/memory/job/io_output/comparison_formatter.rb

Overview

Output the results of jobs into an IO.

Defined Under Namespace

Classes: ComparisonFormatter, EntryFormatter, MetricFormatter

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ IOOutput

Instantiate a new output that writes to an IO.

Parameters:

  • io (#puts)

    The IO to write on.



12
13
14
# File 'lib/benchmark/memory/job/io_output.rb', line 12

def initialize(io)
  @io = io
end

Instance Method Details

#put_comparison(comparison) ⇒ void

This method returns an undefined value.

Put the comparison onto the output.



26
27
28
29
30
# File 'lib/benchmark/memory/job/io_output.rb', line 26

def put_comparison(comparison)
  @io.puts
  @io.puts "Comparison:"
  @io.puts ComparisonFormatter.new(comparison)
end

#put_entry(entry) ⇒ void

This method returns an undefined value.

Put the entry onto the output.



19
20
21
# File 'lib/benchmark/memory/job/io_output.rb', line 19

def put_entry(entry)
  @io.puts EntryFormatter.new(entry)
end

#put_headervoid

This method returns an undefined value.

Put the header onto the output.



35
36
37
# File 'lib/benchmark/memory/job/io_output.rb', line 35

def put_header
  @io.puts "Calculating -------------------------------------"
end

#put_hold_noticevoid

This method returns an undefined value.

Put a notice that the execution is holding for another run.



42
43
44
45
46
# File 'lib/benchmark/memory/job/io_output.rb', line 42

def put_hold_notice
  @io.puts
  @io.puts "Pausing here -- run Ruby again to " \
           "measure the next benchmark..."
end