class StatsD::Instrument::Backends::CaptureBackend
The capture backend is used to capture the metrics that are collected, so you can run assertions on them.
@!attribute collected_metrics
[r]
@return [Array<StatsD::Instrument::Metric>] The list of metrics that were collected.
Attributes
collected_metrics[R]
parent[RW]
Public Class Methods
new()
click to toggle source
# File lib/statsd/instrument/backends/capture_backend.rb, line 14 def initialize reset end
Public Instance Methods
collect_metric(metric)
click to toggle source
Adds a metric to the ist of collected metrics. @param metric [StatsD::Instrument::Metric] The metric to collect. @return [void]
# File lib/statsd/instrument/backends/capture_backend.rb, line 21 def collect_metric(metric) parent&.collect_metric(metric) @collected_metrics << metric end
reset()
click to toggle source
Resets the list of collected metrics to an empty list. @return [void]
# File lib/statsd/instrument/backends/capture_backend.rb, line 28 def reset @collected_metrics = [] end