smart-period 1.0.4 → 1.0.9

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
2
  SHA256:
3
- metadata.gz: f87a8447637e7722692fe6290a0526e1148faf4e25c95189a42ded68bce6e642
4
- data.tar.gz: 51ff60a6dc37c5cb90bb3b821898f61f402df940c15a92827a598deca6a635c7
3
+ metadata.gz: 4080d2ca42a869f1d9d2004c9d94b71695e6382c164a8c40d79e1360535b1b48
4
+ data.tar.gz: f9a9b9e8d956cf063adbfae50643012f2146d086919cf00bf0e879bbc34d2932
5
5
  SHA512:
6
- metadata.gz: b6714f0cf758a3d3a898f567014b736babc4ca5f20ea2a47aa21c4cfa7814303dc609cfae6b7cef8ee7ad1b8f62e32b22a1cc719151443143d1c168994f7a017
7
- data.tar.gz: 0b83c1d0f4975ec8fcc90d604b3204ffbe0add82ca8d1c44487dd956d499c3d641936c0588404518ca399a36bd25f82fc6494001b5e0c67bde7c0833ef6ce21f
6
+ metadata.gz: df0f98369e8cca8811b27759d38608e92e64329c34841f82332b69f3edf41321eecac3f6207e18f907135596d1726a53b1893cb498869e159777867846d24f20
7
+ data.tar.gz: 780bd0cacac4df000645784f2c430f7a4803d36f1395b7568a54fc64cd74da90f6e20a473e42ca28b6349af04033b8a51b39092075f6b06e320772ba0fc94b86
@@ -1,26 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- period (0.1.4)
5
- activesupport (= 5.2.3)
6
- i18n (= 1.6.0)
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 (5.2.3)
11
+ activesupport (6.1.0)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
- i18n (>= 0.7, < 2)
14
- minitest (~> 5.1)
15
- tzinfo (~> 1.1)
16
- concurrent-ruby (1.1.6)
17
- i18n (1.6.0)
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.1)
20
+ minitest (5.14.2)
20
21
  rake (10.5.0)
21
- thread_safe (0.3.6)
22
- tzinfo (1.2.7)
23
- thread_safe (~> 0.1)
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.0.1
35
+ 2.1.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Smart-Period
1
+ # Smart-Period [![Gem Version](https://badge.fury.io/rb/smart-period.svg)](https://badge.fury.io/rb/smart-period) [![Code Climate](https://codeclimate.com/github/billaul/period.svg)](https://codeclimate.com/github/billaul/period) [![Inline docs](http://inch-ci.org/github/billaul/period.svg)](http://inch-ci.org/github/billaul/period)
2
2
 
3
- Smart-Period aims to simplify Time-range manipulation
3
+ Smart-Period aims to simplify Time-range manipulation.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,11 +16,11 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install period
19
+ $ gem install smart-period
20
20
 
21
21
  ## Usage
22
22
 
23
- **Smart-Period** was designed to simplify time-range manipulation, specialy with rails and user input
23
+ **Smart-Period** was designed to simplify time-range manipulation, specialy with rails (~> 5) and user input
24
24
 
25
25
  **Warning** :
26
26
  - A time-range take place between two date and it's different from an abstract duration of time
@@ -29,14 +29,20 @@ Or install it yourself as:
29
29
 
30
30
  ## Quick view (TL;DR)
31
31
  ``` ruby
32
+ require 'period'
33
+
32
34
  # Get all user created today
33
35
  User.where(created_at: Period.today)
36
+
34
37
  # Get how many weeks there is from the beginning of time ?
35
38
  Period.new('01/01/1970'..Time.now).weeks.count
39
+
36
40
  # Is Trump still in charge ?
37
41
  Time.now.in? Period.new('20/01/2017'...'20/01/2021')
42
+
38
43
  # Get the week of an arbitrary date
39
44
  Period.week('24/04/1990')
45
+
40
46
  # Write a date for me (I18n supported)
41
47
  Period.new('20/01/2017'...'20/01/2021').to_s
42
48
  => "From the 20 January 2017 to the 19 January 2021 included"
@@ -71,7 +77,7 @@ Period.new('04/01/2000'..'08/01/2000')
71
77
 
72
78
  ### Standard Period of time
73
79
 
74
- Using **StandardPeriod** you are limited to strictly bordered periods of time
80
+ Using **StandardPeriod** you are limited to strictly bordered periods of time
75
81
  These periods are `day`, `week`, `month`, `quarter` and `year`
76
82
 
77
83
  ```ruby
@@ -117,10 +123,10 @@ Period.today
117
123
  # No comment
118
124
  ```
119
125
 
120
- ## HasMany smaller-periods
126
+ ## HasMany
121
127
 
122
128
  **FreePeriod** and some **StandardPeriod** respond to `.days`, `.weeks`, `.months`, `.quarters` and `.years`
123
- These methods return an array of **StandardPeriod** who are include inside the current period
129
+ These methods return an array of **StandardPeriod** who are overlapping the current period
124
130
 
125
131
  | HasMany -> [\<StandardPeriod>] | .days | .weeks | .months | .quarters | .years |
126
132
  |-------------------------------|:----:|:-----:|:------:|:--------:|:-----:|
@@ -137,9 +143,11 @@ These methods return an array of **StandardPeriod** who are include inside the c
137
143
  Period.new('01/01/1970'..Time.now).weeks.count
138
144
  # How many day in the current quarter
139
145
  Period.this_quarter.days.count
146
+ # Get all the quarters overlapping a Period of time
147
+ Period.new(...).quarters
140
148
  ```
141
149
 
142
- ## BelongsTo greater-period
150
+ ## BelongsTo
143
151
 
144
152
  **StandardPeriod** respond to `.day`, `.week`, `.month`, `.quarter` and `.year`
145
153
  These methods return a **StandardPeriod** who include the current period
@@ -253,11 +261,6 @@ No issues will be addressed outside GitHub
253
261
 
254
262
  * Myself (https://github.com/billaul)
255
263
 
256
- [![Gem Version](https://fury-badge.herokuapp.com/rb/smart-period.png)](http://badge.fury.io/rb/smart-period)
257
- [![Code Climate](https://codeclimate.com/github/billaul/period.png)](https://codeclimate.com/github/billaul/period)
258
- [![Inline docs](http://inch-ci.org/github/billaul/period.png)](http://inch-ci.org/github/billaul/period)
259
-
260
-
261
264
  ## License
262
265
 
263
266
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
File without changes
File without changes
@@ -1,8 +1,11 @@
1
1
  require_relative 'period/version.rb'
2
2
  require 'active_support/all'
3
3
  require 'i18n'
4
- require_relative 'numeric.rb'
5
4
 
5
+ I18n.load_path << File.expand_path("../config/locales/en.yml", __dir__)
6
+ I18n.load_path << File.expand_path("../config/locales/fr.yml", __dir__)
7
+
8
+ require_relative 'numeric.rb'
6
9
  require_relative 'period/free_period.rb'
7
10
  require_relative 'period/day.rb'
8
11
  require_relative 'period/week.rb'
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Period
2
2
 
3
- VERSION = '1.0.4'.freeze
3
+ VERSION = '1.0.9'.freeze
4
4
 
5
5
  end
@@ -6,7 +6,6 @@ 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
11
  # spec.description = "Period.new('01/01/2020'..Time.now)"
@@ -35,11 +34,11 @@ Gem::Specification.new do |spec|
35
34
  end
36
35
  spec.bindir = 'exe'
37
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = %w[lib locals]
37
+ spec.require_paths = %w[lib config]
39
38
 
40
- spec.required_ruby_version = '~> 2.5'
41
- spec.add_runtime_dependency 'activesupport', '5.2.3'
42
- spec.add_runtime_dependency 'i18n', '1.6.0'
39
+ spec.required_ruby_version = '>= 2.5'
40
+ spec.add_runtime_dependency 'activesupport', '>= 5', '< 7'
41
+ spec.add_runtime_dependency 'i18n', '~> 1'
43
42
  spec.add_development_dependency 'bundler', '~> 2.0'
44
43
  spec.add_development_dependency 'rake', '~> 10.0'
45
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
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - billau_l
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-26 00:00:00.000000000 Z
11
+ date: 2021-01-25 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.2.3
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: 5.2.3
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.6.0
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.6.0
46
+ version: '1'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -68,7 +74,6 @@ dependencies:
68
74
  version: '10.0'
69
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,8 +110,6 @@ 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:
@@ -118,10 +123,10 @@ post_install_message:
118
123
  rdoc_options: []
119
124
  require_paths:
120
125
  - lib
121
- - locals
126
+ - config
122
127
  required_ruby_version: !ruby/object:Gem::Requirement
123
128
  requirements:
124
- - - "~>"
129
+ - - ">="
125
130
  - !ruby/object:Gem::Version
126
131
  version: '2.5'
127
132
  required_rubygems_version: !ruby/object:Gem::Requirement