Class: ActiveReporter::Tracker::Delta

Inherits:
Base show all
Defined in:
lib/active_reporter/tracker/delta.rb

Instance Attribute Summary

Attributes inherited from Aggregator::Base

#name, #opts, #report

Instance Method Summary collapse

Methods inherited from Base

#aggregator, #prior_aggregator

Methods inherited from Aggregator::Base

#aggregate, #default_value, #initialize, #sql_value_name

Constructor Details

This class inherits a constructor from ActiveReporter::Aggregator::Base

Instance Method Details

#track(row, prior_row) ⇒ Object



4
5
6
# File 'lib/active_reporter/tracker/delta.rb', line 4

def track(row, prior_row)
  ((row[aggregator].to_f / prior_row[prior_aggregator].to_f) * 100) unless row.nil? || prior_row.nil? || prior_row[prior_aggregator].to_f == 0
end