Module: Increments::Schedule
- Extended by:
- Schedule
- Included in:
- Schedule
- Defined in:
- lib/increments/schedule.rb,
lib/increments/schedule/version.rb
Defined Under Namespace
Classes: Date, WinterVacationSchedule
Constant Summary
collapse
- VERSION =
'0.17.0'
Instance Method Summary
collapse
Instance Method Details
#foundation_anniversary?(date = Date.today) ⇒ Boolean
8
9
10
|
# File 'lib/increments/schedule.rb', line 8
def foundation_anniversary?(date = Date.today)
date.month == 2 && date.day == 29
end
|
#holiday?(date = Date.today) ⇒ Boolean
43
44
45
|
# File 'lib/increments/schedule.rb', line 43
def holiday?(date = Date.today)
HolidayJapan.check(date)
end
|
#pay_day?(date = Date.today) ⇒ Boolean
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/increments/schedule.rb', line 16
def pay_day?(date = Date.today)
return work_day?(date) if date.day == 25
return false if rest_day?(date)
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 = Date.today) ⇒ Boolean
31
32
33
|
# File 'lib/increments/schedule.rb', line 31
def remote_work_day?(date = Date.today)
date.wednesday? && work_day?(date)
end
|
#rest_day?(date = Date.today) ⇒ Boolean
35
36
37
|
# File 'lib/increments/schedule.rb', line 35
def rest_day?(date = Date.today)
weekend?(date) || holiday?(date) || winter_vacation_day?(date)
end
|
#super_hanakin?(date = Date.today) ⇒ Boolean
12
13
14
|
# File 'lib/increments/schedule.rb', line 12
def super_hanakin?(date = Date.today)
date.friday? && pay_day?(date)
end
|
#weekend?(date = Date.today) ⇒ Boolean
39
40
41
|
# File 'lib/increments/schedule.rb', line 39
def weekend?(date = Date.today)
date.saturday? || date.sunday?
end
|
#winter_vacation_day?(date = Date.today) ⇒ Boolean
Also known as:
winter_vacation?
47
48
49
|
# File 'lib/increments/schedule.rb', line 47
def winter_vacation_day?(date = Date.today)
WinterVacationSchedule.new(date).winter_vacation?
end
|
#work_day?(date = Date.today) ⇒ Boolean
27
28
29
|
# File 'lib/increments/schedule.rb', line 27
def work_day?(date = Date.today)
!rest_day?(date)
end
|