Class: ActiveMetric::Bucket

Inherits:
Stat
  • Object
show all
Defined in:
lib/active_metric/statistics/defaults.rb

Constant Summary collapse

MONGO_UNSAFE =
/\.|\$/

Instance Method Summary collapse

Methods inherited from Stat

access_name, #access_name, approximation, class_for, #complete, create_custom_stat, #initialize, #property_from, #subject

Constructor Details

This class inherits a constructor from ActiveMetric::Stat

Instance Method Details

#calculate(measurement) ⇒ Object



67
68
69
70
71
# File 'lib/active_metric/statistics/defaults.rb', line 67

def calculate(measurement)
  key = property_from(measurement).to_s.gsub(MONGO_UNSAFE, "_")
  self.value[key] ||= 0
  self.value[key] += 1
end