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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 78a000f9c75e15e30f47bc79da35b239a5e71a81
4
- data.tar.gz: e031e3f2111035f29cea43467b4ebc21a3f29cb1
2
+ SHA256:
3
+ metadata.gz: 273516dd5f8d88668dcdc503f160cbeb05771183ad1554d413bee129e6bfe88c
4
+ data.tar.gz: '05476799e3a61e0e5305e9b2ec0d639cd254ff8cfe106713ce1a643795576c91'
5
5
  SHA512:
6
- metadata.gz: df35ae4a3b952720c93e0ebae3f8090015e7b392ebda1683fcc9d2d2830cf2e6bc4abce3ab2c38eee87f899f3e4acbed1429edcd8869bb50ce61428f564b53a4
7
- data.tar.gz: 5569f49402c8a2507c8bf0a774ad09fe83072f2c965af6e701cca3cf73f1463d5969288dd4892063531c60018482aad8babe69ecb4bbe8535501747301351550
6
+ metadata.gz: f8a1ef7a936083a5151e92842bb04dfef915bc49beb0e5937a9db9f02c274a53911f338201649941c34a1c3a07345411118ccffe2a9eb40172139080bea55dfc
7
+ data.tar.gz: a9a3df9e8feb60d151e7e0de0f24fc02642852712fa081ca757740c5e7236833f2295defbc69d0ef33a270a14d4b85826aa620595d31f10f66b03c9c7552671c
@@ -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.super_hanakin?(date = Date.today)`
33
+ * `Increments::Schedule.holiday?(date = Date.today)`
35
34
  * `Increments::Schedule.pay_day?(date = Date.today)`
36
- * `Increments::Schedule.work_day?(date = Date.today)`
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.holiday?(date = Date.today)`
40
- * `Increments::Schedule.winter_vacation?(date = Date.today)`
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.each_super_hanakin(max_date = Date.today + 365)`
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.each_work_day(max_date = Date.today + 365)`
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.each_holiday(max_date = Date.today + 365)`
51
- * `Increments::Schedule.each_winter_vacation(max_date = Date.today + 365)`
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
 
@@ -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
- ci_tasks = %w[spec rubocop]
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]
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'increments/schedule/version'
4
4
 
@@ -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) || winter_vacation?(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 winter_vacation?(date = Date.today)
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
 
@@ -1,5 +1,5 @@
1
1
  module Increments
2
2
  module Schedule
3
- VERSION = '0.15.0'
3
+ VERSION = '0.16.1'
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.15.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: 2017-12-28 00:00:00.000000000 Z
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.6.13
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