Class: Benchmark::Memory::Job::IOOutput::MetricFormatter
- Inherits:
-
Object
- Object
- Benchmark::Memory::Job::IOOutput::MetricFormatter
- 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
-
#metric ⇒ Metric
readonly
The metric to format.
Instance Method Summary collapse
-
#initialize(metric) ⇒ MetricFormatter
constructor
Instantiate a formatter to output a metric into an IO.
-
#to_s ⇒ String
Format metric to a string to put on the output.
Methods included from Helpers
Constructor Details
#initialize(metric) ⇒ MetricFormatter
Instantiate a formatter to output a metric into an IO.
14 15 16 |
# File 'lib/benchmark/memory/job/io_output/metric_formatter.rb', line 14 def initialize(metric) @metric = metric end |
Instance Attribute Details
#metric ⇒ Metric (readonly)
Returns The metric to format.
19 20 21 |
# File 'lib/benchmark/memory/job/io_output/metric_formatter.rb', line 19 def metric @metric end |
Instance Method Details
#to_s ⇒ String
Format metric to a string to put on the output.
24 25 26 27 28 29 |
# File 'lib/benchmark/memory/job/io_output/metric_formatter.rb', line 24 def to_s [ format("%s %s", scale(metric.allocated), metric.type), format("(%s retained)", scale(metric.retained)), ].join(" ") end |