boundary_days 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f2af248387bfe2c2244dd0640f02062df9573b73
4
- data.tar.gz: 9460708aef0f314fb6ec2af17952101014ab86fc
2
+ SHA256:
3
+ metadata.gz: 7ecbe501a8057cd4f4ed2af648438d3e6c697313d2381baa58c45ecfce9a28ae
4
+ data.tar.gz: 3eda0bc0a3e2b128adb4b7416176525816b8da07f9696bcc307330dfece20c22
5
5
  SHA512:
6
- metadata.gz: 84b18fc0c1676d3d6596aae8d355d6763404f9b59e8909dec0a4f6c97cfd4c89b5c2a6b1d9b4be22ff4b4ac29b11792b1c903f7ad7b205ce2cab9d2642048991
7
- data.tar.gz: 0715a3d2b1e8d3f1eb245decdbf7dc70b1d19cf940d92313c0cfa6fe48c8bc09c904f436c26ca7197fa42f0e6ccac46a4ba8080df4fa877a7f51354b1efee011
6
+ metadata.gz: 64e5f978bbc03c53e3928d82db6373a1425be66413f925aa3e7a832b00149605e9b126e64caad468c0deed03efa105c879ea901c7a2fa4d13b30bff8620cc630
7
+ data.tar.gz: c267af9629a3495df0d449837c4bfd82a85e885c3d275099bc5704d3c4dabecf4d41fcfa719619b88a4d35f85cf3aab849592689a9f0d741db950a397af6f02a
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.0
data/.travis.yml CHANGED
@@ -1,4 +1,12 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.11.2
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - ruby-head
10
+ before_install:
11
+ - gem update bundler
12
+ - gem install bundler
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/boundary_days.svg)](https://badge.fury.io/rb/boundary_days)
2
+ [![Build Status](https://travis-ci.org/serihiro/boundary_days.svg?branch=master)](https://travis-ci.org/serihiro/boundary_days)
3
+
1
4
  # BoundaryDays
2
5
 
3
6
  Generate Date object list of sensitive dates.
@@ -75,7 +78,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
75
78
 
76
79
  ## Contributing
77
80
 
78
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/boundary_days. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
81
+ Bug reports and pull requests are welcome on GitHub at https://github.com/serihiro/boundary_days. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
79
82
 
80
83
 
81
84
  ## License
data/lib/boundary_days.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'boundary_days/version'
2
+ require 'date'
2
3
 
3
4
  class BoundaryDays
4
5
  extend Forwardable
@@ -68,7 +69,7 @@ class BoundaryDays
68
69
  self
69
70
  end
70
71
 
71
- def build(base_date = Date.today)
72
+ def build(base_date = ::Date.today)
72
73
  from_date = @from || base_date
73
74
  to_date = @to || base_date + DEFAULT_LIMIT_DAYS
74
75
  beginning_of_week_wday = @beginning_of_week_wday || DEFAULT_BEGINNING_OF_WEEK_WDAY
@@ -90,30 +91,34 @@ class BoundaryDays
90
91
  return_days = []
91
92
 
92
93
  first_beginning_of_week = if from_date.wday <= beginning_of_week_wday
93
- Date.new(
94
+ d = Date.new(
94
95
  from_date.year,
95
96
  from_date.month,
96
- from_date.day + beginning_of_week_wday - from_date.wday
97
+ 1
97
98
  )
99
+ d + from_date.day + beginning_of_week_wday - from_date.wday - 1
98
100
  else
99
- Date.new(
101
+ d = Date.new(
100
102
  from_date.year,
101
103
  from_date.month,
102
- from_date.day + 7 + beginning_of_week_wday - from_date.wday
104
+ 1
103
105
  )
106
+ d + from_date.day + 7 + beginning_of_week_wday - from_date.wday - 1
104
107
  end
105
108
  first_end_of_week = if from_date.wday <= end_of_week_wday
106
- Date.new(
109
+ d = Date.new(
107
110
  from_date.year,
108
111
  from_date.month,
109
- from_date.day + end_of_week_wday - from_date.wday
112
+ 1
110
113
  )
114
+ d + from_date.day + end_of_week_wday - from_date.wday - 1
111
115
  else
112
- Date.new(
116
+ d = Date.new(
113
117
  from_date.year,
114
118
  from_date.month,
115
- from_date.day + 7 + end_of_week_wday - from_date.wday
119
+ 1
116
120
  )
121
+ d + from_date.day + 7 + end_of_week_wday - from_date.wday - 1
117
122
  end
118
123
  return_days += first_beginning_of_week.step(to_date, 7).to_a
119
124
  return_days += first_end_of_week.step(to_date, 7).to_a
@@ -1,3 +1,3 @@
1
1
  class BoundaryDays
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boundary_days
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuhiro Serizawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2018-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
+ - ".ruby-version"
64
65
  - ".travis.yml"
65
66
  - CODE_OF_CONDUCT.md
66
67
  - Gemfile
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.4.5.1
96
+ rubygems_version: 2.7.3
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: Generate Date object list of sensitive dates.