Class: Renalware::HD::WeeklyDiary

Inherits:
Diary show all
Defined in:
app/models/renalware/hd/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)


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

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

#archived?Boolean

Returns:

  • (Boolean)


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

def archived?
  false
end

#decorate_slot(slot) ⇒ Object



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

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

#slot_for(*args) ⇒ Object



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

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