increments-schedule 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/.travis.yml +3 -2
- data/Gemfile +2 -2
- data/README.md +1 -1
- data/README.md.erb +1 -1
- data/Rakefile +1 -1
- data/increments-schedule.gemspec +1 -2
- data/lib/increments/schedule.rb +17 -4
- data/lib/increments/schedule/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a000f9c75e15e30f47bc79da35b239a5e71a81
|
4
|
+
data.tar.gz: e031e3f2111035f29cea43467b4ebc21a3f29cb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df35ae4a3b952720c93e0ebae3f8090015e7b392ebda1683fcc9d2d2830cf2e6bc4abce3ab2c38eee87f899f3e4acbed1429edcd8869bb50ce61428f564b53a4
|
7
|
+
data.tar.gz: 5569f49402c8a2507c8bf0a774ad09fe83072f2c965af6e701cca3cf73f1463d5969288dd4892063531c60018482aad8babe69ecb4bbe8535501747301351550
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/README.md.erb
CHANGED
data/Rakefile
CHANGED
@@ -41,7 +41,7 @@ def generate_readme
|
|
41
41
|
erb.result(binding)
|
42
42
|
end
|
43
43
|
|
44
|
-
ci_tasks = %w
|
44
|
+
ci_tasks = %w[spec rubocop]
|
45
45
|
# For some reason MRI 2.3 returns the method list with different order.
|
46
46
|
ci_tasks << 'readme:validate' if RUBY_VERSION.start_with?('2.2.')
|
47
47
|
task ci: ci_tasks
|
data/increments-schedule.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'increments/schedule/version'
|
@@ -9,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ['Yuji Nakayama']
|
10
9
|
spec.email = ['nkymyj@gmail.com']
|
11
10
|
|
12
|
-
spec.summary = "Increments' schedule"
|
11
|
+
spec.summary = "Convenient library for checking Increments' company schedule"
|
13
12
|
spec.description = spec.summary
|
14
13
|
spec.homepage = 'https://github.com/increments/increments-schedule'
|
15
14
|
spec.license = 'MIT'
|
data/lib/increments/schedule.rb
CHANGED
@@ -42,11 +42,9 @@ module Increments
|
|
42
42
|
def winter_vacation?(date = Date.today)
|
43
43
|
case date.month
|
44
44
|
when 1
|
45
|
-
|
46
|
-
date <= ExtendedDate.new(date.year, 1, 1).find_next(&:sunday?)
|
45
|
+
first_three_days_or_adjoining_weekend?(date)
|
47
46
|
when 12
|
48
|
-
|
49
|
-
date >= ExtendedDate.new(date.year, 12, 31).find_previous(&:saturday?)
|
47
|
+
last_four_days_or_after_last_saturday?(date)
|
50
48
|
else
|
51
49
|
false
|
52
50
|
end
|
@@ -66,6 +64,21 @@ module Increments
|
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
67
|
+
private
|
68
|
+
|
69
|
+
def first_three_days_or_adjoining_weekend?(date)
|
70
|
+
jan_3 = ExtendedDate.new(date.year, 1, 3)
|
71
|
+
return true if date <= jan_3
|
72
|
+
first_sunday = ExtendedDate.new(date.year, 1, 1).find_next(&:sunday?)
|
73
|
+
return false unless date.between?(jan_3, first_sunday)
|
74
|
+
jan_3.next_day.upto(first_sunday).all? { |d| weekend?(d) }
|
75
|
+
end
|
76
|
+
|
77
|
+
def last_four_days_or_after_last_saturday?(date)
|
78
|
+
return true if date.day >= 28
|
79
|
+
date >= ExtendedDate.new(date.year, 12, 31).find_previous(&:saturday?)
|
80
|
+
end
|
81
|
+
|
69
82
|
class ExtendedDate < Date
|
70
83
|
INFINITY_FUTURE = Date.new(10_000, 1, 1)
|
71
84
|
INFINITY_PAST = Date.new(0, 1, 1)
|
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.15.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:
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: holiday_japan
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
|
-
description: Increments' schedule
|
41
|
+
description: Convenient library for checking Increments' company schedule
|
42
42
|
email:
|
43
43
|
- nkymyj@gmail.com
|
44
44
|
executables: []
|
@@ -79,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.6.
|
82
|
+
rubygems_version: 2.6.13
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
|
-
summary: Increments' schedule
|
85
|
+
summary: Convenient library for checking Increments' company schedule
|
86
86
|
test_files: []
|