Module: TimeOffPoliciesHelper

Defined in:
app/helpers/time_off_policies_helper.rb

Instance Method Summary collapse

Instance Method Details

#policy_details(policy) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/helpers/time_off_policies_helper.rb', line 2

def policy_details(policy)
  details = []
  details << "on #{Date::DAYNAMES[policy.weekly_accrual_day]}" if policy.weekly_accrual_day.present?
  details << "on day #{policy.monthly_accrual_day}" if policy.monthly_accrual_day.present?
  details << "at #{policy.annual_accrual_timing.humanize}" if policy.annual_accrual_timing.present?
  details << "On Date: #{policy.custom_accrual_date}" if policy.custom_accrual_date.present?
  details.empty? ? 'N/A' : details.join(' | ')
end