boundary_days 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -0
- data/.travis.yml +10 -2
- data/README.md +4 -1
- data/lib/boundary_days.rb +14 -9
- data/lib/boundary_days/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7ecbe501a8057cd4f4ed2af648438d3e6c697313d2381baa58c45ecfce9a28ae
|
4
|
+
data.tar.gz: 3eda0bc0a3e2b128adb4b7416176525816b8da07f9696bcc307330dfece20c22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64e5f978bbc03c53e3928d82db6373a1425be66413f925aa3e7a832b00149605e9b126e64caad468c0deed03efa105c879ea901c7a2fa4d13b30bff8620cc630
|
7
|
+
data.tar.gz: c267af9629a3495df0d449837c4bfd82a85e885c3d275099bc5704d3c4dabecf4d41fcfa719619b88a4d35f85cf3aab849592689a9f0d741db950a397af6f02a
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.0
|
data/.travis.yml
CHANGED
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/
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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:
|
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.
|
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.
|