Class: Models::TimeOff

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

Instance Method Summary collapse

Methods inherited from Base

#dig_custom_field, #initialize

Constructor Details

This class inherits a constructor from Models::Base

Instance Method Details

#created?Boolean

Returns:

  • (Boolean)


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

def created?
  change_type == 'Created'
end

#employeeObject



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

def employee
  identification = email.present? ? email : employee_id
  @employee ||= Bob::Employees.find(identification)
end

#multiple_days?Boolean

Returns:

  • (Boolean)


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

def multiple_days?
  total_days_off > 1
end

#parental_leave?Boolean

Returns:

  • (Boolean)


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

def parental_leave?
  policy_type_display_name == 'Parental Leave'
end

#return_dateObject



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

def return_date
  @return_date = parsed_end_date + 1.day
end

#total_days_offObject



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

def total_days_off
  (parsed_start_date...parsed_end_date).count + 1
end