increments-schedule 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/increments/schedule.rb +1 -14
- data/lib/increments/schedule/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f7c72843760a0a7ffcc31310727662c43485bcc
|
4
|
+
data.tar.gz: 7dd774ebfea58532b530f8c09dd3684b2ca8cbc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e7bf97243fc7cae11475fa83e05128e114f734c8a67272c7b9e5ecee85f4e80ead74e77b9402e34514bae607e7fabc1916bb9cbf4d3dc9f888ae333a63eb46e
|
7
|
+
data.tar.gz: 96ee66daecd9ac0b8af310f31aab52d122790b2489d09ed7c5a87c4b14cf5af9fc9068016ca751d31b0ee0b1320aee43a3aa9c70bdbbee54a8fbdb939f6c7c6e
|
data/README.md
CHANGED
@@ -38,7 +38,6 @@ $ gem install increments-schedule
|
|
38
38
|
* `Increments::Schedule.rest_day?(date = Date.today)`
|
39
39
|
* `Increments::Schedule.weekend?(date = Date.today)`
|
40
40
|
* `Increments::Schedule.holiday?(date = Date.today)`
|
41
|
-
* `Increments::Schedule.summer_vacation?(date = Date.today)`
|
42
41
|
* `Increments::Schedule.winter_vacation?(date = Date.today)`
|
43
42
|
|
44
43
|
### Enumeration Methods
|
@@ -51,7 +50,6 @@ $ gem install increments-schedule
|
|
51
50
|
* `Increments::Schedule.each_rest_day(max_date = Date.today + 365)`
|
52
51
|
* `Increments::Schedule.each_weekend(max_date = Date.today + 365)`
|
53
52
|
* `Increments::Schedule.each_holiday(max_date = Date.today + 365)`
|
54
|
-
* `Increments::Schedule.each_summer_vacation(max_date = Date.today + 365)`
|
55
53
|
* `Increments::Schedule.each_winter_vacation(max_date = Date.today + 365)`
|
56
54
|
|
57
55
|
## Development
|
data/lib/increments/schedule.rb
CHANGED
@@ -32,7 +32,7 @@ module Increments
|
|
32
32
|
alias remote_work_day? work_day?
|
33
33
|
|
34
34
|
def rest_day?(date = Date.today)
|
35
|
-
weekend?(date) || holiday?(date) ||
|
35
|
+
weekend?(date) || holiday?(date) || winter_vacation?(date)
|
36
36
|
end
|
37
37
|
|
38
38
|
def weekend?(date = Date.today)
|
@@ -43,13 +43,6 @@ module Increments
|
|
43
43
|
HolidayJapan.check(date)
|
44
44
|
end
|
45
45
|
|
46
|
-
def summer_vacation?(date = Date.today)
|
47
|
-
return false unless date.month == 8
|
48
|
-
return true if date.day.between?(13, 16)
|
49
|
-
return false if !weekend?(date) && !holiday?(date)
|
50
|
-
any_adjacent_date?(date) { |adjacent_date| summer_vacation?(adjacent_date) }
|
51
|
-
end
|
52
|
-
|
53
46
|
def winter_vacation?(date = Date.today)
|
54
47
|
case date.month
|
55
48
|
when 1
|
@@ -79,12 +72,6 @@ module Increments
|
|
79
72
|
|
80
73
|
private
|
81
74
|
|
82
|
-
def any_adjacent_date?(date, &_block)
|
83
|
-
[(date - 1), (date + 1)].any? do |adjacent_date|
|
84
|
-
yield adjacent_date
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
75
|
def find_date(date, direction)
|
89
76
|
raise ArgumentError unless [:upto, :downto].include?(direction)
|
90
77
|
limit_date = direction == :upto ? INFINITY_FUTURE : INFINITY_PAST
|
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.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: holiday_japan
|