Class: Renalware::HD::Scheduling::WeeklyDiary

Inherits:
Diary show all
Defined in:
app/models/renalware/hd/scheduling/weekly_diary.rb

Defined Under Namespace

Classes: WeeklySlotDecorator

Instance Method Summary collapse

Methods inherited from Diary

policy_class

Methods included from Accountable

#first_or_create_by!, #save_by, #save_by!, #update_by

Instance Method Details

#applies_to_current_week?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'app/models/renalware/hd/scheduling/weekly_diary.rb', line 22

def applies_to_current_week?
  today = Time.zone.today
  [today.cweek, today.year] == [week.week_number, week.year]
end

#archived?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/renalware/hd/scheduling/weekly_diary.rb', line 27

def archived?
  false
end

#decorate_slot(slot) ⇒ Object



37
38
39
# File 'app/models/renalware/hd/scheduling/weekly_diary.rb', line 37

def decorate_slot(slot)
  WeeklySlotDecorator.new(slot)
end

#slot_for(*args) ⇒ Object



41
42
43
# File 'app/models/renalware/hd/scheduling/weekly_diary.rb', line 41

def slot_for(*args)
  (slot = super) && decorate_slot(slot)
end