increments-schedule 0.15.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +7 -3
- data/README.md +10 -9
- data/README.md.erb +4 -5
- data/Rakefile +1 -4
- data/increments-schedule.gemspec +1 -1
- data/lib/increments/schedule.rb +12 -2
- data/lib/increments/schedule/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 273516dd5f8d88668dcdc503f160cbeb05771183ad1554d413bee129e6bfe88c
|
4
|
+
data.tar.gz: '05476799e3a61e0e5305e9b2ec0d639cd254ff8cfe106713ce1a643795576c91'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a1ef7a936083a5151e92842bb04dfef915bc49beb0e5937a9db9f02c274a53911f338201649941c34a1c3a07345411118ccffe2a9eb40172139080bea55dfc
|
7
|
+
data.tar.gz: a9a3df9e8feb60d151e7e0de0f24fc02642852712fa081ca757740c5e7236833f2295defbc69d0ef33a270a14d4b85826aa620595d31f10f66b03c9c7552671c
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
Layout/IndentArray:
|
2
|
+
Enabled: false
|
3
|
+
|
1
4
|
Metrics/BlockLength:
|
2
5
|
Exclude:
|
3
6
|
- spec/**/*.rb
|
@@ -5,6 +8,10 @@ Metrics/BlockLength:
|
|
5
8
|
Metrics/LineLength:
|
6
9
|
Max: 100
|
7
10
|
|
11
|
+
Naming/FileName:
|
12
|
+
Exclude:
|
13
|
+
- increments-schedule.gemspec
|
14
|
+
|
8
15
|
Naming/HeredocDelimiterNaming:
|
9
16
|
Enabled: false
|
10
17
|
|
@@ -23,9 +30,6 @@ Style/EmptyElse:
|
|
23
30
|
Style/GuardClause:
|
24
31
|
Enabled: false
|
25
32
|
|
26
|
-
Style/IndentArray:
|
27
|
-
Enabled: false
|
28
|
-
|
29
33
|
Style/MutableConstant:
|
30
34
|
Enabled: false
|
31
35
|
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
[![Gem Version](http://img.shields.io/gem/v/increments-schedule.svg?style=flat)](http://badge.fury.io/rb/increments-schedule)
|
2
|
-
[![Dependency Status](http://img.shields.io/gemnasium/increments/increments-schedule.svg?style=flat)](https://gemnasium.com/increments/increments-schedule)
|
3
2
|
[![Build Status](https://travis-ci.org/increments/increments-schedule.svg?branch=master&style=flat)](https://travis-ci.org/increments/increments-schedule)
|
4
3
|
|
5
4
|
# Increments::Schedule
|
@@ -31,24 +30,26 @@ $ gem install increments-schedule
|
|
31
30
|
### Predicate Methods
|
32
31
|
|
33
32
|
* `Increments::Schedule.foundation_anniversary?(date = Date.today)`
|
34
|
-
* `Increments::Schedule.
|
33
|
+
* `Increments::Schedule.holiday?(date = Date.today)`
|
35
34
|
* `Increments::Schedule.pay_day?(date = Date.today)`
|
36
|
-
* `Increments::Schedule.
|
35
|
+
* `Increments::Schedule.remote_work_day?(date = Date.today)`
|
37
36
|
* `Increments::Schedule.rest_day?(date = Date.today)`
|
37
|
+
* `Increments::Schedule.super_hanakin?(date = Date.today)`
|
38
38
|
* `Increments::Schedule.weekend?(date = Date.today)`
|
39
|
-
* `Increments::Schedule.
|
40
|
-
* `Increments::Schedule.
|
39
|
+
* `Increments::Schedule.winter_vacation_day?(date = Date.today)`
|
40
|
+
* `Increments::Schedule.work_day?(date = Date.today)`
|
41
41
|
|
42
42
|
### Enumeration Methods
|
43
43
|
|
44
44
|
* `Increments::Schedule.each_foundation_anniversary(max_date = Date.today + 365)`
|
45
|
-
* `Increments::Schedule.
|
45
|
+
* `Increments::Schedule.each_holiday(max_date = Date.today + 365)`
|
46
46
|
* `Increments::Schedule.each_pay_day(max_date = Date.today + 365)`
|
47
|
-
* `Increments::Schedule.
|
47
|
+
* `Increments::Schedule.each_remote_work_day(max_date = Date.today + 365)`
|
48
48
|
* `Increments::Schedule.each_rest_day(max_date = Date.today + 365)`
|
49
|
+
* `Increments::Schedule.each_super_hanakin(max_date = Date.today + 365)`
|
49
50
|
* `Increments::Schedule.each_weekend(max_date = Date.today + 365)`
|
50
|
-
* `Increments::Schedule.
|
51
|
-
* `Increments::Schedule.
|
51
|
+
* `Increments::Schedule.each_winter_vacation_day(max_date = Date.today + 365)`
|
52
|
+
* `Increments::Schedule.each_work_day(max_date = Date.today + 365)`
|
52
53
|
|
53
54
|
## Development
|
54
55
|
|
data/README.md.erb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
[![Gem Version](http://img.shields.io/gem/v/increments-schedule.svg?style=flat)](http://badge.fury.io/rb/increments-schedule)
|
2
|
-
[![Dependency Status](http://img.shields.io/gemnasium/increments/increments-schedule.svg?style=flat)](https://gemnasium.com/increments/increments-schedule)
|
3
2
|
[![Build Status](https://travis-ci.org/increments/increments-schedule.svg?branch=master&style=flat)](https://travis-ci.org/increments/increments-schedule)
|
4
3
|
|
5
4
|
# Increments::Schedule
|
@@ -32,8 +31,8 @@ $ gem install increments-schedule
|
|
32
31
|
|
33
32
|
<%=
|
34
33
|
methods = Increments::Schedule.public_instance_methods.select do |method|
|
35
|
-
method.to_s.end_with?('?')
|
36
|
-
end
|
34
|
+
method.to_s.end_with?('?') && method != :winter_vacation?
|
35
|
+
end.sort
|
37
36
|
|
38
37
|
methods.map do |method|
|
39
38
|
"* `Increments::Schedule.#{method}(date = Date.today)`"
|
@@ -44,8 +43,8 @@ end.join("\n")
|
|
44
43
|
|
45
44
|
<%=
|
46
45
|
methods = Increments::Schedule.public_instance_methods.select do |method|
|
47
|
-
method.to_s.start_with?('each_')
|
48
|
-
end
|
46
|
+
method.to_s.start_with?('each_') && method != :each_winter_vacation
|
47
|
+
end.sort
|
49
48
|
|
50
49
|
methods.map do |method|
|
51
50
|
"* `Increments::Schedule.#{method}(max_date = Date.today + 365)`"
|
data/Rakefile
CHANGED
@@ -41,7 +41,4 @@ def generate_readme
|
|
41
41
|
erb.result(binding)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
# For some reason MRI 2.3 returns the method list with different order.
|
46
|
-
ci_tasks << 'readme:validate' if RUBY_VERSION.start_with?('2.2.')
|
47
|
-
task ci: ci_tasks
|
44
|
+
task ci: %w[spec rubocop readme:validate]
|
data/increments-schedule.gemspec
CHANGED
data/lib/increments/schedule.rb
CHANGED
@@ -16,6 +16,7 @@ module Increments
|
|
16
16
|
def pay_day?(date = Date.today)
|
17
17
|
return work_day?(date) if date.day == 25
|
18
18
|
return false if rest_day?(date)
|
19
|
+
|
19
20
|
next_basic_pay_day = Date.new(date.year, date.month, 25)
|
20
21
|
next_basic_pay_day = next_basic_pay_day.next_month if date > next_basic_pay_day
|
21
22
|
date.next_day.upto(next_basic_pay_day).all? do |date_until_basic_pay_day|
|
@@ -27,8 +28,12 @@ module Increments
|
|
27
28
|
!rest_day?(date)
|
28
29
|
end
|
29
30
|
|
31
|
+
def remote_work_day?(date = Date.today)
|
32
|
+
date.wednesday? && work_day?(date)
|
33
|
+
end
|
34
|
+
|
30
35
|
def rest_day?(date = Date.today)
|
31
|
-
weekend?(date) || holiday?(date) ||
|
36
|
+
weekend?(date) || holiday?(date) || winter_vacation_day?(date)
|
32
37
|
end
|
33
38
|
|
34
39
|
def weekend?(date = Date.today)
|
@@ -39,7 +44,7 @@ module Increments
|
|
39
44
|
HolidayJapan.check(date)
|
40
45
|
end
|
41
46
|
|
42
|
-
def
|
47
|
+
def winter_vacation_day?(date = Date.today)
|
43
48
|
case date.month
|
44
49
|
when 1
|
45
50
|
first_three_days_or_adjoining_weekend?(date)
|
@@ -50,6 +55,8 @@ module Increments
|
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
58
|
+
alias winter_vacation? winter_vacation_day?
|
59
|
+
|
53
60
|
public_instance_methods.select { |name| name.to_s.end_with?('?') }.each do |predicate_method|
|
54
61
|
enumeration_method = 'each_' + predicate_method.to_s.sub(/\?\z/, '')
|
55
62
|
|
@@ -69,13 +76,16 @@ module Increments
|
|
69
76
|
def first_three_days_or_adjoining_weekend?(date)
|
70
77
|
jan_3 = ExtendedDate.new(date.year, 1, 3)
|
71
78
|
return true if date <= jan_3
|
79
|
+
|
72
80
|
first_sunday = ExtendedDate.new(date.year, 1, 1).find_next(&:sunday?)
|
73
81
|
return false unless date.between?(jan_3, first_sunday)
|
82
|
+
|
74
83
|
jan_3.next_day.upto(first_sunday).all? { |d| weekend?(d) }
|
75
84
|
end
|
76
85
|
|
77
86
|
def last_four_days_or_after_last_saturday?(date)
|
78
87
|
return true if date.day >= 28
|
88
|
+
|
79
89
|
date >= ExtendedDate.new(date.year, 12, 31).find_previous(&:saturday?)
|
80
90
|
end
|
81
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: increments-schedule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: holiday_japan
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.7.7
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Convenient library for checking Increments' company schedule
|