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

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/benchmark/memory/job/io_output/metric_formatter.rb

Overview

Format metrics for use with the IOOutput.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#rjust, scale

Constructor Details

#initialize(metric) ⇒ MetricFormatter

Instantiate a formatter to output a metric into an IO.

Parameters:



16
17
18
# File 'lib/benchmark/memory/job/io_output/metric_formatter.rb', line 16

def initialize(metric)
  @metric = metric
end

Instance Attribute Details

#metricMetric (readonly)

Returns The metric to format.

Returns:

  • (Metric)

    The metric to format.



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

def metric
  @metric
end

Instance Method Details

#to_sString

Format metric to a string to put on the output.

Returns:

  • (String)


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

def to_s
  [allocated_message, retained_message].join(' ')
end