Class: Values::Pleasure
- Inherits:
-
Object
- Object
- Values::Pleasure
- Defined in:
- app/models/values/pleasure.rb
Overview
A value that might be assigned to an Activity.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(label) ⇒ Pleasure
constructor
A new instance of Pleasure.
- #to_s ⇒ Object
Constructor Details
#initialize(label) ⇒ Pleasure
Returns a new instance of Pleasure.
15 16 17 |
# File 'app/models/values/pleasure.rb', line 15 def initialize(label) @label = label end |
Class Method Details
.from_intensity(intensity) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/models/values/pleasure.rb', line 4 def self.from_intensity(intensity) return "Not answered" if intensity.nil? if intensity < 4 new("Not Fun") elsif intensity < 7 new("Kind of fun") else new("Really fun") end end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'app/models/values/pleasure.rb', line 19 def to_s @label.to_s end |