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.

@see StatsD::Instrument::Assertions

Attributes

collected_metrics[R]

Public Class Methods

new() click to toggle source
# File lib/statsd/instrument/backends/capture_backend.rb, line 12
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 19
def 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 25
def reset
  @collected_metrics = []
end