Class: Calorie::DayOfTheWeek

Inherits:
Object
  • Object
show all
Defined in:
lib/calorie/day_of_the_week.rb

Instance Method Summary collapse

Constructor Details

#initialize(day_of_the_week) ⇒ DayOfTheWeek

Returns a new instance of DayOfTheWeek.



3
4
5
# File 'lib/calorie/day_of_the_week.rb', line 3

def initialize(day_of_the_week)
  @day_of_the_week = day_of_the_week
end

Instance Method Details

#labelObject



7
8
9
# File 'lib/calorie/day_of_the_week.rb', line 7

def label
  @label ||= Calorie.day_names[@day_of_the_week]
end

#weekend?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/calorie/day_of_the_week.rb', line 11

def weekend?
  [0, 6].include?(@day_of_the_week)
end