Class: Values::Pleasure

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(label) ⇒ Pleasure

Returns a new instance of Pleasure.



16
17
18
# File 'app/models/values/pleasure.rb', line 16

def initialize(label)
  @label = label
end

Class Method Details

.from_intensity(intensity) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/models/values/pleasure.rb', line 5

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_sObject



20
21
22
# File 'app/models/values/pleasure.rb', line 20

def to_s
  @label.to_s
end