Module: ESP::StatTotals

Included in:
Stat, StatCustomSignature, StatRegion, StatService, StatSignature
Defined in:
lib/esp/resources/concerns/stat_totals.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#destroyObject

Not Implemented. You cannot delete a Stat.



8
9
10
# File 'lib/esp/resources/concerns/stat_totals.rb', line 8

def destroy
  fail ESP::NotImplementedError
end

#saveObject

Not Implemented. You cannot create or update a Stat.



3
4
5
# File 'lib/esp/resources/concerns/stat_totals.rb', line 3

def save
  fail ESP::NotImplementedError
end

#totalObject

We only add new_1w* and old* fields as the new_1w field includes the counts from new_1h and new_1d.



13
14
15
# File 'lib/esp/resources/concerns/stat_totals.rb', line 13

def total
  attributes.select { |a, _v| a.match(/new_1w|old/) }.values.reduce(:+)
end

#total_suppressedObject



17
18
19
# File 'lib/esp/resources/concerns/stat_totals.rb', line 17

def total_suppressed
  attributes.select { |a, _v| a.match(/suppressed_/) }.values.reduce(:+)
end