Class: Models::TimeOff

Inherits:
Base
  • Object
show all
Defined in:
lib/bob/models/time_off.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Models::Base

Instance Method Details

#created?Boolean



13
14
15
# File 'lib/bob/models/time_off.rb', line 13

def created?
  change_type == 'Created'
end

#employeeObject



5
6
7
# File 'lib/bob/models/time_off.rb', line 5

def employee
  @employee ||= Bob::Employees.find(employee_id)
end

#multiple_days?Boolean



21
22
23
# File 'lib/bob/models/time_off.rb', line 21

def multiple_days?
  total_days_off > 1
end

#parental_leave?Boolean



9
10
11
# File 'lib/bob/models/time_off.rb', line 9

def parental_leave?
  policy_type_display_name == 'Parental Leave'
end

#return_dateObject



17
18
19
# File 'lib/bob/models/time_off.rb', line 17

def return_date
  @return_date = parsed_end_date + 1.day
end

#total_days_offObject



25
26
27
# File 'lib/bob/models/time_off.rb', line 25

def total_days_off
  (start_date...end_date).count + 1
end