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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6651624066fc41e06e60861b336170c73848ecf
4
- data.tar.gz: 9a1e35492daa18f6e9931658d9243aa46235e0d8
3
+ metadata.gz: 78a000f9c75e15e30f47bc79da35b239a5e71a81
4
+ data.tar.gz: e031e3f2111035f29cea43467b4ebc21a3f29cb1
5
5
  SHA512:
6
- metadata.gz: e0db0575b67beba4eb1a27a5529bb6dd40e4dd755b1d8ab292211c9dfa923239b1d21f97436d5c8d352f70d0f69c4bb9870ed032d9093efad636ba3b7c027030
7
- data.tar.gz: c2d763c638f846d96e40227a4966ee9d7afe241bf357fd5e96737ea7bdb7b7ed941c2b2c7a1174033f13d0b8f90cc71b7ed75397220cac9e5ad10b75141fee58
6
+ metadata.gz: df35ae4a3b952720c93e0ebae3f8090015e7b392ebda1683fcc9d2d2830cf2e6bc4abce3ab2c38eee87f899f3e4acbed1429edcd8869bb50ce61428f564b53a4
7
+ data.tar.gz: 5569f49402c8a2507c8bf0a774ad09fe83072f2c965af6e701cca3cf73f1463d5969288dd4892063531c60018482aad8babe69ecb4bbe8535501747301351550
data/.rubocop.yml CHANGED
@@ -1,6 +1,16 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - spec/**/*.rb
4
+
1
5
  Metrics/LineLength:
2
6
  Max: 100
3
7
 
8
+ Naming/HeredocDelimiterNaming:
9
+ Enabled: false
10
+
11
+ Naming/VariableNumber:
12
+ Enabled: false
13
+
4
14
  Metrics/ModuleLength:
5
15
  Enabled: false
6
16
 
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
4
- - 2.3.0
3
+ - 2.2.7
4
+ - 2.3.4
5
+ - 2.4.1
5
6
  script: bundle exec rake ci
6
7
  sudo: false
7
8
  cache: bundler
data/Gemfile CHANGED
@@ -3,9 +3,9 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development, :test do
6
- gem 'rake', '~> 10.0'
6
+ gem 'rake', '~> 12.0'
7
7
  gem 'rspec', '~> 3.2'
8
- gem 'rubocop', '~> 0.30'
8
+ gem 'rubocop', '~> 0.52'
9
9
  gem 'timecop', '~> 0.7'
10
10
  end
11
11
 
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Increments::Schedule
6
6
 
7
- Find out our special remote days and eagerly wait for them!
7
+ **Increments::Schedule** is a convenient library for checking Increments' company schedule.
8
8
 
9
9
  ## Installation
10
10
 
data/README.md.erb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Increments::Schedule
6
6
 
7
- Find out our special remote days and eagerly wait for them!
7
+ **Increments::Schedule** is a convenient library for checking Increments' company schedule.
8
8
 
9
9
  ## Installation
10
10
 
data/Rakefile CHANGED
@@ -41,7 +41,7 @@ def generate_readme
41
41
  erb.result(binding)
42
42
  end
43
43
 
44
- ci_tasks = %w(spec rubocop)
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
@@ -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'
@@ -42,11 +42,9 @@ module Increments
42
42
  def winter_vacation?(date = Date.today)
43
43
  case date.month
44
44
  when 1
45
- return true if date.day <= 3
46
- date <= ExtendedDate.new(date.year, 1, 1).find_next(&:sunday?)
45
+ first_three_days_or_adjoining_weekend?(date)
47
46
  when 12
48
- return true if date.day >= 28
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)
@@ -1,5 +1,5 @@
1
1
  module Increments
2
2
  module Schedule
3
- VERSION = '0.14.0'
3
+ VERSION = '0.15.0'
4
4
  end
5
5
  end
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.14.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: 2016-12-23 00:00:00.000000000 Z
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.8
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: []