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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b8c9a536348bdcdb4ba014247949c1d75702d32
4
- data.tar.gz: 897a83acff15520acd8894a84ad9f59b87b04c78
3
+ metadata.gz: f3251963d1b77cb0e04a98a148b6f02483cf37b2
4
+ data.tar.gz: 0a9b9ac035fec9425ca749825a9ec3aee07fc049
5
5
  SHA512:
6
- metadata.gz: a264fc1c3822c9c9576eef0be7bff725965fdd5ab7614de7238c30a12f079e5e92d91f453920f5dfe8065ac43b0e7312ccce6e8cf66b8ac27937626f30f805fd
7
- data.tar.gz: a40ad96539b574c50eae7ed418bb4b2e9a0410583ccf22b46ea64df02c86ecd687840953113e95b756a8ba66a99e8742beb35f54227b6fcb47b9deb85df02d07
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
@@ -36,7 +36,7 @@ methods = Increments::Schedule.public_instance_methods.select do |method|
36
36
  end
37
37
 
38
38
  methods.map do |method|
39
- "* `Increments::Schedule.#{method}(date)`"
39
+ "* `Increments::Schedule.#{method}(date = Date.today)`"
40
40
  end.join("\n")
41
41
  %>
42
42
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Increments
2
2
  module Schedule
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: increments-schedule
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama