Class: Totalizer::Message
- Inherits:
-
Object
- Object
- Totalizer::Message
- Defined in:
- lib/totalizer/message.rb
Direct Known Subclasses
ActivationMessage, ChurnMessage, EngagementMessage, MetricMessage, RetentionMessage
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/totalizer/message.rb', line 3 def description @description end |
#duration ⇒ Object
Returns the value of attribute duration.
3 4 5 |
# File 'lib/totalizer/message.rb', line 3 def duration @duration end |
#text ⇒ Object
Returns the value of attribute text.
3 4 5 |
# File 'lib/totalizer/message.rb', line 3 def text @text end |
Instance Method Details
#percentage_string(value) ⇒ Object
13 14 15 |
# File 'lib/totalizer/message.rb', line 13 def percentage_string value "#{(value.to_f * 100).round(2).to_s.gsub(/.0$/, '')}%" end |
#period_string ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/totalizer/message.rb', line 5 def period_string if duration > 1 "Last #{duration} #{'day'.pluralize(duration)}" else duration == 0 ? 'Today' : 'Yesterday' end end |