class Benchmark::Memory::Job::IOOutput::EntryFormatter
Format entries for use with the IOOutput
.
Attributes
entry[R]
@return [Entry] The entry to format.
Public Class Methods
new(entry)
click to toggle source
Instantiate a formatter to output an entry into an IO.
@param entry [Entry] The entry to format.
# File lib/benchmark/memory/job/io_output/entry_formatter.rb, line 16 def initialize(entry) @entry = entry end
Public Instance Methods
to_s()
click to toggle source
Format entry to a string to put on the output.
@return [String]
# File lib/benchmark/memory/job/io_output/entry_formatter.rb, line 26 def to_s output = StringIO.new output << rjust(entry.label) entry.measurement.each_with_index.map do |metric, index| output << " " * 20 unless index == 0 output << MetricFormatter.new(metric) output << "\n" end output.string end