Class: DeepTest::Metrics::Gatherer::Section
- Inherits:
-
Object
- Object
- DeepTest::Metrics::Gatherer::Section
- Defined in:
- lib/deep_test/metrics/gatherer.rb
Instance Method Summary collapse
- #gather_measurements ⇒ Object
-
#initialize(title, &generate_measurements_block) ⇒ Section
constructor
A new instance of Section.
- #measurement(name, value) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(title, &generate_measurements_block) ⇒ Section
Returns a new instance of Section.
46 47 48 49 |
# File 'lib/deep_test/metrics/gatherer.rb', line 46 def initialize(title, &generate_measurements_block) @title = title @generate_measurements_block = generate_measurements_block end |
Instance Method Details
#gather_measurements ⇒ Object
55 56 57 58 |
# File 'lib/deep_test/metrics/gatherer.rb', line 55 def gather_measurements @measurements = [] @generate_measurements_block.call(self) end |
#measurement(name, value) ⇒ Object
51 52 53 |
# File 'lib/deep_test/metrics/gatherer.rb', line 51 def measurement(name, value) @measurements << [name, value] end |
#render ⇒ Object
60 61 62 63 |
# File 'lib/deep_test/metrics/gatherer.rb', line 60 def render gather_measurements "[#{@title}]\n" + @measurements.map {|name, value| "#{name}: #{value}"}.join("\n") end |