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.



14
15
16
# File 'lib/benchmark/memory/job/io_output.rb', line 14

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.



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

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.



21
22
23
# File 'lib/benchmark/memory/job/io_output.rb', line 21

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

#put_headervoid

This method returns an undefined value.

Put the header onto the output.



37
38
39
# File 'lib/benchmark/memory/job/io_output.rb', line 37

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.



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

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