Class: CloudWatchMetrics::Resque::Builder
- Inherits:
-
Object
- Object
- CloudWatchMetrics::Resque::Builder
- Defined in:
- lib/cloud_watch_metrics/resque/builder.rb
Instance Method Summary collapse
- #build(info) ⇒ Object
-
#initialize(metrics) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(metrics) ⇒ Builder
Returns a new instance of Builder.
6 7 8 9 10 |
# File 'lib/cloud_watch_metrics/resque/builder.rb', line 6 def initialize(metrics) @metric_names = metrics.select do |key, value| value && key != :pending_per_queue end.keys end |
Instance Method Details
#build(info) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cloud_watch_metrics/resque/builder.rb', line 12 def build(info) @info = info metric_data = @metric_names.map do |key| build_datum(camelize(key.to_s), @info.public_send(key)) end metric_data.concat(build_per_queue) if @info.queue_sizes metric_data end |