class Models::TimeOff
Public Instance Methods
created?()
click to toggle source
# File lib/bob/models/time_off.rb, line 13 def created? change_type == 'Created' end
employee()
click to toggle source
# File lib/bob/models/time_off.rb, line 5 def employee @employee ||= Bob::Employees.find(employee_id) end
multiple_days?()
click to toggle source
# File lib/bob/models/time_off.rb, line 21 def multiple_days? total_days_off > 1 end
parental_leave?()
click to toggle source
# File lib/bob/models/time_off.rb, line 9 def parental_leave? policy_type_display_name == 'Parental Leave' end
return_date()
click to toggle source
# File lib/bob/models/time_off.rb, line 17 def return_date @return_date = parsed_end_date + 1.day end
total_days_off()
click to toggle source
# File lib/bob/models/time_off.rb, line 25 def total_days_off (start_date...end_date).count + 1 end
Private Instance Methods
parsed_end_date()
click to toggle source
# File lib/bob/models/time_off.rb, line 35 def parsed_end_date Date.parse(end_date) end
parsed_start_date()
click to toggle source
# File lib/bob/models/time_off.rb, line 31 def parsed_start_date Date.parse(start_date) end