Class: ActiveReporter::Calculator::Ratio
- Inherits:
-
Base
- Object
- Aggregator::Base
- Base
- ActiveReporter::Calculator::Ratio
- Defined in:
- lib/active_reporter/calculator/ratio.rb
Instance Attribute Summary
Attributes inherited from Aggregator::Base
Instance Method Summary collapse
Methods inherited from Base
#aggregator, #parent_aggregator, #totals?
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
#calculate(row, parent_row) ⇒ Object
4 5 6 |
# File 'lib/active_reporter/calculator/ratio.rb', line 4 def calculate(row, parent_row) ((row[aggregator].to_f / parent_row[parent_aggregator].to_f) * 100) unless parent_row[parent_aggregator].to_f.zero? end |