increments-schedule 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -10
- data/README.md.erb +1 -1
- data/lib/increments/schedule.rb +11 -11
- data/lib/increments/schedule/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3251963d1b77cb0e04a98a148b6f02483cf37b2
|
4
|
+
data.tar.gz: 0a9b9ac035fec9425ca749825a9ec3aee07fc049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a013a38c8091ba7c49e885f94bf26238c820648f960036dd2be167969f4583c26dd1c4cc368b145cbf192f382db0a485d48c645eb3d9f61b8bbaf312069f00d1
|
7
|
+
data.tar.gz: 8fd02b4216c64ddf61679cdb01a5cffd2109173a167e4ebbabe6afa7770c1f4abdff9340cd0fbf1eb44a47378f346956e1b6cd679dbe2d17fb892a517afc7bcb
|
data/README.md
CHANGED
@@ -30,16 +30,16 @@ $ gem install increments-schedule
|
|
30
30
|
|
31
31
|
### Predicate Methods
|
32
32
|
|
33
|
-
* `Increments::Schedule.super_hanakin?(date)`
|
34
|
-
* `Increments::Schedule.pay_day?(date)`
|
35
|
-
* `Increments::Schedule.work_day?(date)`
|
36
|
-
* `Increments::Schedule.office_work_day?(date)`
|
37
|
-
* `Increments::Schedule.remote_work_day?(date)`
|
38
|
-
* `Increments::Schedule.normal_remote_work_day?(date)`
|
39
|
-
* `Increments::Schedule.special_remote_work_day?(date)`
|
40
|
-
* `Increments::Schedule.rest_day?(date)`
|
41
|
-
* `Increments::Schedule.weekend?(date)`
|
42
|
-
* `Increments::Schedule.holiday?(date)`
|
33
|
+
* `Increments::Schedule.super_hanakin?(date = Date.today)`
|
34
|
+
* `Increments::Schedule.pay_day?(date = Date.today)`
|
35
|
+
* `Increments::Schedule.work_day?(date = Date.today)`
|
36
|
+
* `Increments::Schedule.office_work_day?(date = Date.today)`
|
37
|
+
* `Increments::Schedule.remote_work_day?(date = Date.today)`
|
38
|
+
* `Increments::Schedule.normal_remote_work_day?(date = Date.today)`
|
39
|
+
* `Increments::Schedule.special_remote_work_day?(date = Date.today)`
|
40
|
+
* `Increments::Schedule.rest_day?(date = Date.today)`
|
41
|
+
* `Increments::Schedule.weekend?(date = Date.today)`
|
42
|
+
* `Increments::Schedule.holiday?(date = Date.today)`
|
43
43
|
|
44
44
|
### Enumeration Methods
|
45
45
|
|
data/README.md.erb
CHANGED
data/lib/increments/schedule.rb
CHANGED
@@ -5,11 +5,11 @@ module Increments
|
|
5
5
|
module Schedule
|
6
6
|
extend self # rubocop:disable ModuleFunction
|
7
7
|
|
8
|
-
def super_hanakin?(date)
|
8
|
+
def super_hanakin?(date = Date.today)
|
9
9
|
date.friday? && pay_day?(date)
|
10
10
|
end
|
11
11
|
|
12
|
-
def pay_day?(date)
|
12
|
+
def pay_day?(date = Date.today)
|
13
13
|
return work_day?(date) if date.day == 25
|
14
14
|
next_basic_pay_day = Date.new(date.year, date.month, 25)
|
15
15
|
next_basic_pay_day = next_basic_pay_day.next_month if date > next_basic_pay_day
|
@@ -18,36 +18,36 @@ module Increments
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def work_day?(date)
|
21
|
+
def work_day?(date = Date.today)
|
22
22
|
!rest_day?(date)
|
23
23
|
end
|
24
24
|
|
25
|
-
def office_work_day?(date)
|
25
|
+
def office_work_day?(date = Date.today)
|
26
26
|
work_day?(date) && !remote_work_day?(date)
|
27
27
|
end
|
28
28
|
|
29
|
-
def remote_work_day?(date)
|
29
|
+
def remote_work_day?(date = Date.today)
|
30
30
|
normal_remote_work_day?(date) || special_remote_work_day?(date)
|
31
31
|
end
|
32
32
|
|
33
|
-
def normal_remote_work_day?(date)
|
33
|
+
def normal_remote_work_day?(date = Date.today)
|
34
34
|
date.monday? && work_day?(date)
|
35
35
|
end
|
36
36
|
|
37
|
-
def special_remote_work_day?(date)
|
37
|
+
def special_remote_work_day?(date = Date.today)
|
38
38
|
normal_office_work_day?(date) &&
|
39
39
|
!normal_office_work_day?(date - 1) && !normal_office_work_day?(date + 1)
|
40
40
|
end
|
41
41
|
|
42
|
-
def rest_day?(date)
|
42
|
+
def rest_day?(date = Date.today)
|
43
43
|
weekend?(date) || holiday?(date)
|
44
44
|
end
|
45
45
|
|
46
|
-
def weekend?(date)
|
46
|
+
def weekend?(date = Date.today)
|
47
47
|
date.saturday? || date.sunday?
|
48
48
|
end
|
49
49
|
|
50
|
-
def holiday?(date)
|
50
|
+
def holiday?(date = Date.today)
|
51
51
|
HolidayJapan.check(date)
|
52
52
|
end
|
53
53
|
|
@@ -67,7 +67,7 @@ module Increments
|
|
67
67
|
|
68
68
|
private
|
69
69
|
|
70
|
-
def normal_office_work_day?(date)
|
70
|
+
def normal_office_work_day?(date = Date.today)
|
71
71
|
!rest_day?(date) && !normal_remote_work_day?(date)
|
72
72
|
end
|
73
73
|
end
|