Module: Bodhi::AggregateMetrics
- Included in:
- Metric
- Defined in:
- lib/bodhi/definitions/aggregate.rb
Instance Method Summary collapse
- #aggregate(*args) ⇒ Object
- #average(*args) ⇒ Object
- #maximum(*args) ⇒ Object
- #minimum(*args) ⇒ Object
- #sum(*args) ⇒ Object
Instance Method Details
#aggregate(*args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bodhi/definitions/aggregate.rb', line 19 def aggregate (*args) = args. agg_method = args[0] [:model_name] = args[1] field = args[2] [:block] = get_agg_block(agg_method, field) [:name] ||= "#{[:model_name]}_#{agg_method}_#{field}" define() end |
#average(*args) ⇒ Object
3 4 5 |
# File 'lib/bodhi/definitions/aggregate.rb', line 3 def average (*args) aggregate *args.unshift(:average) end |
#maximum(*args) ⇒ Object
11 12 13 |
# File 'lib/bodhi/definitions/aggregate.rb', line 11 def maximum (*args) aggregate *args.unshift(:maximum) end |
#minimum(*args) ⇒ Object
15 16 17 |
# File 'lib/bodhi/definitions/aggregate.rb', line 15 def minimum (*args) aggregate *args.unshift(:minimum) end |
#sum(*args) ⇒ Object
7 8 9 |
# File 'lib/bodhi/definitions/aggregate.rb', line 7 def sum (*args) aggregate *args.unshift(:sum) end |