Module: Increments::Schedule
- Extended by:
- Schedule
- Included in:
- Schedule
- Defined in:
- lib/increments/schedule.rb,
lib/increments/schedule/version.rb
Constant Summary collapse
- VERSION =
'0.3.0'
Instance Method Summary collapse
- #holiday?(date) ⇒ Boolean
- #normal_remote_work_day?(date) ⇒ Boolean
- #office_work_day?(date) ⇒ Boolean
- #pay_day?(date) ⇒ Boolean
- #remote_work_day?(date) ⇒ Boolean
- #rest_day?(date) ⇒ Boolean
- #special_remote_work_day?(date) ⇒ Boolean
- #super_hanakin?(date) ⇒ Boolean
- #weekend?(date) ⇒ Boolean
Instance Method Details
#holiday?(date) ⇒ Boolean
64 65 66 |
# File 'lib/increments/schedule.rb', line 64 def holiday?(date) HolidayJapan.check(date) end |
#normal_remote_work_day?(date) ⇒ Boolean
43 44 45 |
# File 'lib/increments/schedule.rb', line 43 def normal_remote_work_day?(date) date.monday? && !rest_day?(date) end |
#office_work_day?(date) ⇒ Boolean
52 53 54 |
# File 'lib/increments/schedule.rb', line 52 def office_work_day?(date) !rest_day?(date) && !remote_work_day?(date) end |
#pay_day?(date) ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/increments/schedule.rb', line 30 def pay_day?(date) return !rest_day?(date) if date.day == 25 next_basic_pay_day = Date.new(date.year, date.month, 25) next_basic_pay_day = next_basic_pay_day.next_month if date > next_basic_pay_day date.next_day.upto(next_basic_pay_day).all? do |date_until_basic_pay_day| rest_day?(date_until_basic_pay_day) end end |
#remote_work_day?(date) ⇒ Boolean
39 40 41 |
# File 'lib/increments/schedule.rb', line 39 def remote_work_day?(date) normal_remote_work_day?(date) || special_remote_work_day?(date) end |
#rest_day?(date) ⇒ Boolean
56 57 58 |
# File 'lib/increments/schedule.rb', line 56 def rest_day?(date) weekend?(date) || holiday?(date) end |
#special_remote_work_day?(date) ⇒ Boolean
47 48 49 50 |
# File 'lib/increments/schedule.rb', line 47 def special_remote_work_day?(date) normal_office_work_day?(date) && !normal_office_work_day?(date - 1) && !normal_office_work_day?(date + 1) end |
#super_hanakin?(date) ⇒ Boolean
26 27 28 |
# File 'lib/increments/schedule.rb', line 26 def super_hanakin?(date) pay_day?(date) && date.friday? end |
#weekend?(date) ⇒ Boolean
60 61 62 |
# File 'lib/increments/schedule.rb', line 60 def weekend?(date) date.saturday? || date.sunday? end |