Class: Totalizer::EngagementMessage
- Defined in:
- lib/totalizer/message.rb
Instance Attribute Summary
Attributes inherited from Message
#description, #duration, #text
Instance Method Summary collapse
-
#initialize(growth_metric, activity_metric, duration) ⇒ EngagementMessage
constructor
A new instance of EngagementMessage.
Methods inherited from Message
#percentage_string, #period_string
Constructor Details
#initialize(growth_metric, activity_metric, duration) ⇒ EngagementMessage
Returns a new instance of EngagementMessage.
55 56 57 58 59 60 61 |
# File 'lib/totalizer/message.rb', line 55 def initialize growth_metric, activity_metric, duration self.duration = duration existing_active = (growth_metric.start_ids & activity_metric.ids).size self.text = "#{period_string}: #{percentage_string existing_active.to_f / growth_metric.start.to_f} (#{existing_active}/#{growth_metric.start})" self.description = Totalizer.descriptions.engagement end |