smart-period 1.0.1 → 1.0.7
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 +4 -4
- data/Gemfile.lock +16 -15
- data/README.md +237 -10
- data/{locales → config/locales}/en.yml +1 -0
- data/{locales → config/locales}/fr.yml +24 -0
- data/lib/period.rb +7 -7
- data/lib/period/free_period.rb +19 -11
- data/lib/period/has_many/weeks.rb +0 -1
- data/lib/period/standard_period.rb +0 -6
- data/lib/period/version.rb +1 -1
- data/period.gemspec +9 -7
- metadata +24 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2f52d692e80ad1fd610219f147275d392a3a74d127ccc52ce29fea1a6809f56
|
4
|
+
data.tar.gz: f43df7bfa7bff5caff9229979fb7dc02e91c3ebab263362118e23f37ddb473f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 527752082a31d6d62e5ea90f3b25cf963fd9721e661419d9c7b217b5bdbea56d36cf77fa29df07a95b5006ff36b772aa3b299d170512641cee1f612b77bbc230
|
7
|
+
data.tar.gz: 919552b28b752e4ffca7c29390b937f618a87b71779afbc0166a01d438d397521dfaf2e414697f860699eb5640d9f216666180ab0f3956cea224f860c778d312
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
period (0.
|
5
|
-
activesupport (
|
6
|
-
i18n (
|
4
|
+
smart-period (1.0.6)
|
5
|
+
activesupport (>= 5, < 7)
|
6
|
+
i18n (~> 1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (6.1.0)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (>=
|
14
|
-
minitest (
|
15
|
-
tzinfo (~>
|
16
|
-
|
17
|
-
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
zeitwerk (~> 2.3)
|
17
|
+
concurrent-ruby (1.1.7)
|
18
|
+
i18n (1.8.5)
|
18
19
|
concurrent-ruby (~> 1.0)
|
19
|
-
minitest (5.14.
|
20
|
+
minitest (5.14.2)
|
20
21
|
rake (10.5.0)
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
tzinfo (2.0.4)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
zeitwerk (2.4.2)
|
24
25
|
|
25
26
|
PLATFORMS
|
26
27
|
ruby
|
@@ -28,7 +29,7 @@ PLATFORMS
|
|
28
29
|
DEPENDENCIES
|
29
30
|
bundler (~> 2.0)
|
30
31
|
rake (~> 10.0)
|
31
|
-
period!
|
32
|
+
smart-period!
|
32
33
|
|
33
34
|
BUNDLED WITH
|
34
|
-
2.
|
35
|
+
2.1.2
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# Period
|
1
|
+
# Smart-Period [](https://badge.fury.io/rb/smart-period) [](https://codeclimate.com/github/billaul/period) [](http://inch-ci.org/github/billaul/period)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Smart-Period aims to simplify Time-range manipulation.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,246 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
**Smart-Period** was designed to simplify time-range manipulation, specialy with rails (~> 5) and user input
|
24
|
+
|
25
|
+
**Warning** :
|
26
|
+
- A time-range take place between two date and it's different from an abstract duration of time
|
27
|
+
- **Smart-Period** is limited at full day of time and will always round the starting and ending to the beginning and the ending of the day
|
28
|
+
|
29
|
+
|
30
|
+
## Quick view (TL;DR)
|
31
|
+
``` ruby
|
32
|
+
require 'period'
|
33
|
+
|
34
|
+
# Get all user created today
|
35
|
+
User.where(created_at: Period.today)
|
36
|
+
|
37
|
+
# Get how many weeks there is from the beginning of time ?
|
38
|
+
Period.new('01/01/1970'..Time.now).weeks.count
|
39
|
+
|
40
|
+
# Is Trump still in charge ?
|
41
|
+
Time.now.in? Period.new('20/01/2017'...'20/01/2021')
|
42
|
+
|
43
|
+
# Get the week of an arbitrary date
|
44
|
+
Period.week('24/04/1990')
|
45
|
+
|
46
|
+
# Write a date for me (I18n supported)
|
47
|
+
Period.new('20/01/2017'...'20/01/2021').to_s
|
48
|
+
=> "From the 20 January 2017 to the 19 January 2021 included"
|
49
|
+
```
|
50
|
+
|
51
|
+
## Detailed view
|
52
|
+
|
53
|
+
There's two way to create and manipulate a period of time `FreePeriod` and `StandardPeriod`
|
54
|
+
|
55
|
+
### FreePeriod of time
|
56
|
+
|
57
|
+
You can declare **FreePeriod** as simply as :
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# With Date objects
|
61
|
+
Period.new(3.month.ago..Date.today)
|
62
|
+
# or with Strings
|
63
|
+
Period.new('01/01/2000'...'01/02/2000')
|
64
|
+
# or with a mix
|
65
|
+
Period.new('01/01/2000'..1.week.ago)
|
66
|
+
# or in a rails Controller with params
|
67
|
+
Period.new(params[:start_date]..params[:end_date])
|
68
|
+
```
|
69
|
+
|
70
|
+
**FreePeriod** can be manipulated with `+` and `-`
|
71
|
+
Doing so will move the start **and** the end of the period
|
72
|
+
```ruby
|
73
|
+
Period.new('01/01/2000'..'05/01/2000') + 3.day
|
74
|
+
# is equal to
|
75
|
+
Period.new('04/01/2000'..'08/01/2000')
|
76
|
+
```
|
77
|
+
|
78
|
+
### Standard Period of time
|
79
|
+
|
80
|
+
Using **StandardPeriod** you are limited to strictly bordered periods of time
|
81
|
+
These periods are `day`, `week`, `month`, `quarter` and `year`
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
# To get the week, 42th day ago
|
85
|
+
Period.week(42.day.ago)
|
86
|
+
# To get the first month of 2020
|
87
|
+
Period.month('01/01/2020')
|
88
|
+
# or if you like it verbious
|
89
|
+
Period::Month.new('01/01/2020')
|
90
|
+
# or if you need the current week
|
91
|
+
Period.week(Time.now)
|
92
|
+
```
|
93
|
+
|
94
|
+
**Note** : If you ask for a `month`, `quarter` of `year`, the day part of your param doesn't matter `01/01/2020` give the same result as `14/01/2020` or `29/01/2020`
|
95
|
+
|
96
|
+
**StandardPeriod** can be manipulated with `+` and `-` and will always return a **StandardPeriod** of the same type
|
97
|
+
```ruby
|
98
|
+
# Subtraction are made from the start of the period
|
99
|
+
Period.month('10/02/2000') - 1.day
|
100
|
+
# Return the previous month
|
101
|
+
# Addition are made from the end
|
102
|
+
Period.month('10/02/2000') + 1.day
|
103
|
+
# Return the next month
|
104
|
+
Period.week('10/02/2000') + 67.day
|
105
|
+
# Return a week
|
106
|
+
```
|
107
|
+
**StandardPeriod** also respond to `.next` and `.prev`
|
108
|
+
```ruby
|
109
|
+
Period.month('01/01/2000').next.next.next
|
110
|
+
# Return the month of April 2020
|
111
|
+
```
|
112
|
+
|
113
|
+
You can quickly access close period of time with `.(last|this|next)_(day|week|month|quarter|year)` and `.yesterday` `.today` `.tomorrow`
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
Period.this_week
|
117
|
+
# Same as Period.week(Time.now) but shorter
|
118
|
+
Period.next_month
|
119
|
+
# Return the next month
|
120
|
+
Period.last_year
|
121
|
+
# Return the last year
|
122
|
+
Period.today
|
123
|
+
# No comment
|
124
|
+
```
|
125
|
+
|
126
|
+
## HasMany
|
127
|
+
|
128
|
+
**FreePeriod** and some **StandardPeriod** respond to `.days`, `.weeks`, `.months`, `.quarters` and `.years`
|
129
|
+
These methods return an array of **StandardPeriod** who are overlapping the current period
|
130
|
+
|
131
|
+
| HasMany -> [\<StandardPeriod>] | .days | .weeks | .months | .quarters | .years |
|
132
|
+
|-------------------------------|:----:|:-----:|:------:|:--------:|:-----:|
|
133
|
+
| FreePeriod | X | X | X | X | X |
|
134
|
+
| StandardPeriod::Day | | | | | |
|
135
|
+
| StandardPeriod::Week | X | | | | |
|
136
|
+
| StandardPeriod::Month | X | X | | | |
|
137
|
+
| StandardPeriod::Quarter | X | X | X | | |
|
138
|
+
| StandardPeriod::Year | X | X | X | X | |
|
139
|
+
|
140
|
+
#### Example
|
141
|
+
```ruby
|
142
|
+
# Get how many weeks there is from the beginning of time ?
|
143
|
+
Period.new('01/01/1970'..Time.now).weeks.count
|
144
|
+
# How many day in the current quarter
|
145
|
+
Period.this_quarter.days.count
|
146
|
+
# Get all the quarters overlapping a Period of time
|
147
|
+
Period.new(...).quarters
|
148
|
+
```
|
149
|
+
|
150
|
+
## BelongsTo
|
151
|
+
|
152
|
+
**StandardPeriod** respond to `.day`, `.week`, `.month`, `.quarter` and `.year`
|
153
|
+
These methods return a **StandardPeriod** who include the current period
|
154
|
+
**FreePeriod** does not respond to these methods
|
155
|
+
|
156
|
+
| BelongTo -> StandardPeriod | .day | .week | .month | .quarter | .year |
|
157
|
+
|----------------------------|:---:|:----:|:-----:|:-------:|:----:|
|
158
|
+
| FreePeriod | | | | | |
|
159
|
+
| StandardPeriod::Day | | X | X | X | X |
|
160
|
+
| StandardPeriod::Week | | | X | X | X |
|
161
|
+
| StandardPeriod::Month | | | | X | X |
|
162
|
+
| StandardPeriod::Quarter | | | | | X |
|
163
|
+
| StandardPeriod::Year | | | | | |
|
164
|
+
|
165
|
+
#### Example with BelongTo and HasMany
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
# Get the first day, of the last week, of the second month, of the current year
|
169
|
+
Period.this_year.months.second.weeks.last.days.first
|
170
|
+
```
|
171
|
+
|
172
|
+
## ActiveRecord
|
173
|
+
|
174
|
+
As **Period** inherite from **Range**, you can natively use them in **ActiveRecord** query
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
# Get all book published this year
|
178
|
+
Book.where(published_at: Period.this_year)
|
179
|
+
```
|
180
|
+
|
181
|
+
## Rails Controller
|
182
|
+
|
183
|
+
In a Controller, use the error handling to validate the date for you
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
class BookController < ApplicationController
|
187
|
+
def between # match via GET and POST
|
188
|
+
# Default value for the range in GET context
|
189
|
+
params[:from] ||= 1.month.ago
|
190
|
+
params[:to] ||= Time.now
|
191
|
+
|
192
|
+
begin
|
193
|
+
# Retrieve books from the DB
|
194
|
+
@books = Book.where(published: Period.new(params[:from]..params[:to]))
|
195
|
+
rescue ArgumentError => e
|
196
|
+
# Period will handle mis-formatted date and incoherent period
|
197
|
+
# I18n is support for errors messages
|
198
|
+
flash[:alert] = e.message
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
```
|
203
|
+
|
204
|
+
## I18n and to_s
|
205
|
+
|
206
|
+
I18n is supported for `en` and `fr`
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
Period.new('01/01/2000'...'01/02/2001').to_s
|
210
|
+
=> "From the 01 January 2000 to the 31 January 2001 included"
|
211
|
+
I18n.locale = :fr
|
212
|
+
Period.new('01/01/2000'...'01/02/2001').to_s
|
213
|
+
=> "Du 01 janvier 2000 au 31 janvier 2001 inclus"
|
214
|
+
```
|
215
|
+
Errors are also supported
|
216
|
+
```ruby
|
217
|
+
Period.new 'Foo'..'Bar'
|
218
|
+
#=> ArgumentError (The start date is invalid)
|
219
|
+
Period.new '01/02/3030'..'Bar'
|
220
|
+
#=> ArgumentError (The end date is invalid)
|
221
|
+
Period.new '01/02/3030'..'01/01/2020'
|
222
|
+
#=> ArgumentError (The start date is greater than the end date)
|
223
|
+
```
|
224
|
+
|
225
|
+
See `locales/en.yml` to implement your language support
|
226
|
+
|
227
|
+
If you need to change the format for a single call
|
228
|
+
|
229
|
+
```ruby
|
230
|
+
period.to_s(format: 'Your Format')
|
231
|
+
# or
|
232
|
+
period.strftime('Your Format')
|
233
|
+
```
|
234
|
+
For a FreePeriod or if you need to print the start and the end of your period differently, use `.i18n`
|
235
|
+
```ruby
|
236
|
+
period.i18n do |from, to|
|
237
|
+
"You have from #{from.strftime(...)} until #{to.strftime(...)} to deliver the money !"
|
238
|
+
end
|
239
|
+
```
|
240
|
+
|
241
|
+
## The tricky case of Weeks
|
242
|
+
|
243
|
+
Weeks are implemented following the [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date)
|
244
|
+
So `Period.this_month.weeks.first` doesn't necessarily include the first days of the month
|
245
|
+
|
246
|
+
## TimeZone
|
247
|
+
|
248
|
+
Time zone are supported, you have nothing to do
|
249
|
+
If you change the global `Time.zone` of your app, you have nothing to do
|
250
|
+
If your Period [begin in a time zone and end in another](https://en.wikipedia.org/wiki/Daylight_saving_time), you have nothing to do
|
26
251
|
|
27
|
-
##
|
252
|
+
## Bug reports
|
28
253
|
|
29
|
-
|
254
|
+
If you discover any bugs, feel free to create an [issue on GitHub](https://github.com/billaul/period/issues)
|
255
|
+
Please add as much information as possible to help us in fixing the potential bug
|
256
|
+
We also encourage you to help even more by forking and sending us a pull request
|
30
257
|
|
31
|
-
|
258
|
+
No issues will be addressed outside GitHub
|
32
259
|
|
33
|
-
##
|
260
|
+
## Maintainer
|
34
261
|
|
35
|
-
|
262
|
+
* Myself (https://github.com/billaul)
|
36
263
|
|
37
264
|
## License
|
38
265
|
|
@@ -6,6 +6,7 @@ en:
|
|
6
6
|
end_date_is_invalid: The end date is invalid
|
7
7
|
start_is_greater_than_end: The start date is greater than the end date
|
8
8
|
incomparable_error: Cannot compare Arguments
|
9
|
+
param_must_be_a_range: The parameter must inherit from the Range class
|
9
10
|
standard_period:
|
10
11
|
date_is_invalid: The date is invalid
|
11
12
|
day:
|
@@ -7,6 +7,7 @@ fr:
|
|
7
7
|
start_is_greater_than_end: Date de début supérieur à la date de fin
|
8
8
|
incomparable_error: Les arguments ne sont pas comparables
|
9
9
|
must_implement_to_datetime: L'argument doit repondre a "to_datetime"
|
10
|
+
param_must_be_a_range: Le paramètre doit hériter de la class Range
|
10
11
|
standard_period:
|
11
12
|
day:
|
12
13
|
default_format: '%{wday} %{day} %{month} %{year}'
|
@@ -18,3 +19,26 @@ fr:
|
|
18
19
|
default_format: '%{quarter_nb} semestre %{year}'
|
19
20
|
year:
|
20
21
|
default_format: '%{year}'
|
22
|
+
date:
|
23
|
+
month_names:
|
24
|
+
-
|
25
|
+
- janvier
|
26
|
+
- février
|
27
|
+
- mars
|
28
|
+
- avril
|
29
|
+
- mai
|
30
|
+
- juin
|
31
|
+
- juillet
|
32
|
+
- août
|
33
|
+
- septembre
|
34
|
+
- octobre
|
35
|
+
- novembre
|
36
|
+
- décembre
|
37
|
+
day_names:
|
38
|
+
- dimanche
|
39
|
+
- lundi
|
40
|
+
- mardi
|
41
|
+
- mercredi
|
42
|
+
- jeudi
|
43
|
+
- vendredi
|
44
|
+
- samedi
|
data/lib/period.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'period/version.rb'
|
2
2
|
require 'active_support/all'
|
3
3
|
require 'i18n'
|
4
|
-
|
4
|
+
require_relative 'numeric.rb'
|
5
5
|
require_relative 'period/free_period.rb'
|
6
6
|
require_relative 'period/day.rb'
|
7
7
|
require_relative 'period/week.rb'
|
@@ -34,8 +34,8 @@ module Period
|
|
34
34
|
Object.const_get("Period::#{period.capitalize}").new(date)
|
35
35
|
end
|
36
36
|
|
37
|
-
define_method period.to_s do
|
38
|
-
Object.const_get("Period::#{period.capitalize}")
|
37
|
+
define_method period.to_s do |range|
|
38
|
+
Object.const_get("Period::#{period.capitalize}").new(range)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -50,10 +50,10 @@ module Period
|
|
50
50
|
|
51
51
|
case last_next
|
52
52
|
when 'last'
|
53
|
-
from =
|
54
|
-
|
55
|
-
|
56
|
-
to =
|
53
|
+
from = count.to_i.send(klass).ago.send("beginning_of_#{klass}")
|
54
|
+
to = env_time.now
|
55
|
+
to -= 1.send(klass) unless method_name.match?(/from_now$/)
|
56
|
+
to = to.send("end_of_#{klass}")
|
57
57
|
when 'next'
|
58
58
|
from = env_time.now
|
59
59
|
from += 1.send(klass) unless method_name.match?(/from_now$/)
|
data/lib/period/free_period.rb
CHANGED
@@ -5,9 +5,6 @@ require_relative 'has_many/months.rb'
|
|
5
5
|
require_relative 'has_many/quarters.rb'
|
6
6
|
require_relative 'has_many/years.rb'
|
7
7
|
|
8
|
-
I18n.load_path << 'locales/fr.yml'
|
9
|
-
I18n.load_path << 'locales/en.yml'
|
10
|
-
|
11
8
|
class Period::FreePeriod < Range
|
12
9
|
include Comparable
|
13
10
|
|
@@ -18,15 +15,16 @@ class Period::FreePeriod < Range
|
|
18
15
|
include Period::HasMany::Years
|
19
16
|
|
20
17
|
def initialize(range)
|
18
|
+
raise ::ArgumentError, I18n.t(:param_must_be_a_range, scope: %i[period free_period]) unless range.class.ancestors.include?(Range)
|
21
19
|
from = range.first
|
22
20
|
to = range.last
|
23
21
|
|
24
22
|
from = time_parse(range.first, I18n.t(:start_date_is_invalid, scope: %i[period free_period])).beginning_of_day
|
25
23
|
to = time_parse(range.last, I18n.t(:end_date_is_invalid, scope: %i[period free_period])).end_of_day
|
26
|
-
|
24
|
+
to = to.prev_day if range.exclude_end?
|
27
25
|
raise ::ArgumentError, I18n.t(:start_is_greater_than_end, scope: %i[period free_period]) if from > to
|
28
26
|
|
29
|
-
super(from, to
|
27
|
+
super(from, to)
|
30
28
|
end
|
31
29
|
|
32
30
|
alias from first
|
@@ -44,10 +42,6 @@ class Period::FreePeriod < Range
|
|
44
42
|
raise NotImplementedError
|
45
43
|
end
|
46
44
|
|
47
|
-
def self.from_date(_date)
|
48
|
-
raise NotImplementedError
|
49
|
-
end
|
50
|
-
|
51
45
|
def include?(other)
|
52
46
|
if other.class.in?([DateTime, Time, ActiveSupport::TimeWithZone])
|
53
47
|
from.to_i <= other.to_i && other.to_i <= to.to_i
|
@@ -74,8 +68,22 @@ class Period::FreePeriod < Range
|
|
74
68
|
days.count.days
|
75
69
|
end
|
76
70
|
|
77
|
-
def -(
|
78
|
-
self.class.new((from -
|
71
|
+
def -(duration)
|
72
|
+
self.class.new((from - duration)..(to - duration))
|
73
|
+
end
|
74
|
+
|
75
|
+
def +(duration)
|
76
|
+
self.class.new((from + duration)..(to + duration))
|
77
|
+
end
|
78
|
+
|
79
|
+
def ==(other)
|
80
|
+
raise ArgumentError unless other.class.ancestors.include?(Period::FreePeriod)
|
81
|
+
|
82
|
+
from == other.from && to == other.to
|
83
|
+
end
|
84
|
+
|
85
|
+
def strftime(format)
|
86
|
+
to_s(format: format)
|
79
87
|
end
|
80
88
|
|
81
89
|
def to_s(format: '%d %B %Y')
|
data/lib/period/version.rb
CHANGED
data/period.gemspec
CHANGED
@@ -6,10 +6,9 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'smart-period'
|
7
7
|
spec.version = Period::VERSION
|
8
8
|
spec.authors = ['billau_l']
|
9
|
-
spec.email = ['billau_l@modulotech.fr']
|
10
9
|
|
11
10
|
spec.summary = 'Manage time ranges without brain damage.'
|
12
|
-
spec.description = "Period.new('01/01/2020'..Time.now)"
|
11
|
+
# spec.description = "Period.new('01/01/2020'..Time.now)"
|
13
12
|
spec.homepage = "https://github.com/billaul/period"
|
14
13
|
spec.license = 'MIT'
|
15
14
|
|
@@ -18,8 +17,10 @@ Gem::Specification.new do |spec|
|
|
18
17
|
if spec.respond_to?(:metadata)
|
19
18
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
19
|
|
21
|
-
spec.metadata["
|
22
|
-
|
20
|
+
spec.metadata["bug_tracker_uri"] = spec.homepage + '/issues'
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["documentation_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
23
24
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
25
|
else
|
25
26
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
@@ -33,10 +34,11 @@ Gem::Specification.new do |spec|
|
|
33
34
|
end
|
34
35
|
spec.bindir = 'exe'
|
35
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
-
spec.require_paths = %w[lib
|
37
|
+
spec.require_paths = %w[lib]
|
37
38
|
|
38
|
-
spec.
|
39
|
-
spec.add_runtime_dependency '
|
39
|
+
spec.required_ruby_version = '> 2.5'
|
40
|
+
spec.add_runtime_dependency 'activesupport', '>= 5', '< 7'
|
41
|
+
spec.add_runtime_dependency 'i18n', '~> 1'
|
40
42
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
41
43
|
spec.add_development_dependency 'rake', '~> 10.0'
|
42
44
|
end
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart-period
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- billau_l
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5
|
19
|
+
version: '5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '7'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: i18n
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1
|
39
|
+
version: '1'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1
|
46
|
+
version: '1'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,9 +72,8 @@ dependencies:
|
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '10.0'
|
69
|
-
description:
|
75
|
+
description:
|
70
76
|
email:
|
71
|
-
- billau_l@modulotech.fr
|
72
77
|
executables: []
|
73
78
|
extensions: []
|
74
79
|
extra_rdoc_files: []
|
@@ -81,6 +86,8 @@ files:
|
|
81
86
|
- Rakefile
|
82
87
|
- bin/console
|
83
88
|
- bin/setup
|
89
|
+
- config/locales/en.yml
|
90
|
+
- config/locales/fr.yml
|
84
91
|
- lib/.DS_Store
|
85
92
|
- lib/numeric.rb
|
86
93
|
- lib/period.rb
|
@@ -103,24 +110,24 @@ files:
|
|
103
110
|
- lib/period/version.rb
|
104
111
|
- lib/period/week.rb
|
105
112
|
- lib/period/year.rb
|
106
|
-
- locales/en.yml
|
107
|
-
- locales/fr.yml
|
108
113
|
- period.gemspec
|
109
114
|
homepage: https://github.com/billaul/period
|
110
115
|
licenses:
|
111
116
|
- MIT
|
112
117
|
metadata:
|
118
|
+
bug_tracker_uri: https://github.com/billaul/period/issues
|
113
119
|
homepage_uri: https://github.com/billaul/period
|
120
|
+
documentation_uri: https://github.com/billaul/period
|
121
|
+
source_code_uri: https://github.com/billaul/period
|
114
122
|
post_install_message:
|
115
123
|
rdoc_options: []
|
116
124
|
require_paths:
|
117
125
|
- lib
|
118
|
-
- locals
|
119
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
127
|
requirements:
|
121
|
-
- - "
|
128
|
+
- - ">"
|
122
129
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
130
|
+
version: '2.5'
|
124
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
132
|
requirements:
|
126
133
|
- - ">="
|