easy_time 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -9
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +80 -59
- data/README.md +10 -10
- data/easy_time.gemspec +3 -0
- data/lib/easy_time/version.rb +1 -1
- data/lib/easy_time.rb +13 -13
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14627cb45389f5f6d02c4018cd289ec5d395f333b4fc898065c3ac0309f245f4
|
4
|
+
data.tar.gz: 0e4cf658977e8c650a0210155e1e471eee52dae57340d12b04f85c23621c2e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb8d35eb1e50d9ead87c14e3cfb929fb5e1d9bd754b262151903e7525479af1cc2018c63cb1305778c69ccf370d6764f43ce7e4ae5e8d5e8399412ef68f50d2
|
7
|
+
data.tar.gz: 17425e181160189a63d2b51f101a8723eb4257bb07e6cc1d6112a07c6e512f4dba4c8ad8c66c3773a5a2b9e01156b04f7358c043b55b775b4727028207a636f3
|
data/.circleci/config.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
version: 2.1
|
2
2
|
orbs:
|
3
|
-
ruby: circleci/ruby@
|
3
|
+
ruby: circleci/ruby@2.1.0
|
4
4
|
|
5
5
|
defaults: &DEFAULTS
|
6
6
|
resource_class: small
|
7
7
|
docker:
|
8
|
-
- image:
|
8
|
+
- image: cimg/ruby:2.7.7
|
9
9
|
|
10
10
|
environment:
|
11
11
|
BUNDLE_JOBS: 3
|
@@ -17,7 +17,7 @@ defaults: &DEFAULTS
|
|
17
17
|
jobs:
|
18
18
|
build:
|
19
19
|
docker:
|
20
|
-
- image:
|
20
|
+
- image: cimg/ruby:2.7.7
|
21
21
|
executor: ruby/default
|
22
22
|
steps:
|
23
23
|
- checkout
|
@@ -31,7 +31,7 @@ jobs:
|
|
31
31
|
|
32
32
|
- run:
|
33
33
|
name: Install bundler
|
34
|
-
command: gem install bundler
|
34
|
+
command: gem install bundler -v 2.4.22
|
35
35
|
|
36
36
|
- run:
|
37
37
|
name: Check bundle version
|
@@ -93,7 +93,7 @@ jobs:
|
|
93
93
|
|
94
94
|
- run:
|
95
95
|
name: Install bundler
|
96
|
-
command: gem install bundler
|
96
|
+
command: gem install bundler -v 2.4.22
|
97
97
|
|
98
98
|
- run:
|
99
99
|
name: set the bundle path
|
@@ -114,9 +114,9 @@ jobs:
|
|
114
114
|
bundle exec rake clean
|
115
115
|
bundle exec rake build
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
- deploy:
|
118
|
+
name: Release and push
|
119
|
+
command: bundle exec rake release
|
120
120
|
|
121
121
|
workflows:
|
122
122
|
version: 2
|
@@ -129,4 +129,3 @@ workflows:
|
|
129
129
|
filters:
|
130
130
|
branches:
|
131
131
|
only: master
|
132
|
-
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Change Log for EasyTime
|
2
|
+
|
3
|
+
## [0.2.2] - 2024-01-18
|
4
|
+
|
5
|
+
### Added
|
6
|
+
This `CHANGELOG.md` file
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
Added `activesupport` to the development dependencies in the gemspec
|
10
|
+
|
11
|
+
Updated the `initializer` method to not use the "presence" method.
|
12
|
+
|
13
|
+
Updated several gems to their latest versions.
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
easy_time (0.2.
|
4
|
+
easy_time (0.2.2)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
10
|
+
activesupport (7.1.3)
|
11
|
+
base64
|
12
|
+
bigdecimal
|
11
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
mutex_m
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
base64 (0.2.0)
|
22
|
+
bigdecimal (3.1.6)
|
17
23
|
builder (3.2.4)
|
18
24
|
byebug (11.1.3)
|
19
|
-
coderay (1.1.
|
20
|
-
concurrent-ruby (1.
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
coderay (1.1.3)
|
26
|
+
concurrent-ruby (1.2.3)
|
27
|
+
connection_pool (2.4.1)
|
28
|
+
diff-lcs (1.5.0)
|
29
|
+
docile (1.4.0)
|
30
|
+
drb (2.2.0)
|
31
|
+
ruby2_keywords
|
32
|
+
ffi (1.16.3)
|
33
|
+
formatador (1.1.0)
|
34
|
+
fuubar (2.5.1)
|
26
35
|
rspec-core (~> 3.0)
|
27
36
|
ruby-progressbar (~> 1.4)
|
28
|
-
guard (2.
|
37
|
+
guard (2.18.1)
|
29
38
|
formatador (>= 0.2.4)
|
30
39
|
listen (>= 2.7, < 4.0)
|
31
40
|
lumberjack (>= 1.0.12, < 2.0)
|
32
41
|
nenv (~> 0.1)
|
33
42
|
notiffany (~> 0.0)
|
34
|
-
pry (>= 0.
|
43
|
+
pry (>= 0.13.0)
|
35
44
|
shellany (~> 0.0)
|
36
45
|
thor (>= 0.18.1)
|
37
46
|
guard-compat (1.2.1)
|
@@ -42,80 +51,92 @@ GEM
|
|
42
51
|
guard-yard (2.2.1)
|
43
52
|
guard (>= 1.1.0)
|
44
53
|
yard (>= 0.7.0)
|
45
|
-
i18n (1.
|
54
|
+
i18n (1.14.1)
|
46
55
|
concurrent-ruby (~> 1.0)
|
47
|
-
|
48
|
-
|
56
|
+
json (2.7.1)
|
57
|
+
language_server-protocol (3.17.0.3)
|
58
|
+
listen (3.8.0)
|
49
59
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
50
60
|
rb-inotify (~> 0.9, >= 0.9.10)
|
51
|
-
lumberjack (1.2.
|
61
|
+
lumberjack (1.2.10)
|
52
62
|
method_source (1.0.0)
|
53
|
-
minitest (5.
|
63
|
+
minitest (5.21.2)
|
64
|
+
mutex_m (0.2.0)
|
54
65
|
nenv (0.3.0)
|
55
66
|
notiffany (0.1.3)
|
56
67
|
nenv (~> 0.1)
|
57
68
|
shellany (~> 0.0)
|
58
|
-
parallel (1.
|
59
|
-
parser (
|
60
|
-
ast (~> 2.4.
|
61
|
-
|
69
|
+
parallel (1.24.0)
|
70
|
+
parser (3.3.0.4)
|
71
|
+
ast (~> 2.4.1)
|
72
|
+
racc
|
73
|
+
pry (0.14.2)
|
62
74
|
coderay (~> 1.1)
|
63
75
|
method_source (~> 1.0)
|
64
|
-
pry-byebug (3.
|
76
|
+
pry-byebug (3.10.1)
|
65
77
|
byebug (~> 11.0)
|
66
|
-
pry (
|
67
|
-
|
68
|
-
|
69
|
-
|
78
|
+
pry (>= 0.13, < 0.15)
|
79
|
+
racc (1.7.3)
|
80
|
+
rainbow (3.1.1)
|
81
|
+
rake (13.1.0)
|
82
|
+
rb-fsevent (0.11.2)
|
70
83
|
rb-inotify (0.10.1)
|
71
84
|
ffi (~> 1.0)
|
72
|
-
redcarpet (3.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
rspec-
|
77
|
-
rspec-
|
78
|
-
|
79
|
-
|
80
|
-
|
85
|
+
redcarpet (3.6.0)
|
86
|
+
regexp_parser (2.9.0)
|
87
|
+
rexml (3.2.6)
|
88
|
+
rspec (3.12.0)
|
89
|
+
rspec-core (~> 3.12.0)
|
90
|
+
rspec-expectations (~> 3.12.0)
|
91
|
+
rspec-mocks (~> 3.12.0)
|
92
|
+
rspec-core (3.12.2)
|
93
|
+
rspec-support (~> 3.12.0)
|
94
|
+
rspec-expectations (3.12.3)
|
81
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-mocks (3.
|
96
|
+
rspec-support (~> 3.12.0)
|
97
|
+
rspec-mocks (3.12.6)
|
84
98
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-support (3.
|
99
|
+
rspec-support (~> 3.12.0)
|
100
|
+
rspec-support (3.12.1)
|
87
101
|
rspec_junit (4.0.4)
|
88
102
|
builder (>= 3.2.2)
|
89
103
|
rspec (>= 3.3.0)
|
90
|
-
rspec_junit_formatter (0.
|
104
|
+
rspec_junit_formatter (0.6.0)
|
91
105
|
rspec-core (>= 2, < 4, != 2.12.0)
|
92
|
-
rubocop (
|
93
|
-
|
106
|
+
rubocop (1.60.1)
|
107
|
+
json (~> 2.3)
|
108
|
+
language_server-protocol (>= 3.17.0)
|
94
109
|
parallel (~> 1.10)
|
95
|
-
parser (>=
|
110
|
+
parser (>= 3.3.0.2)
|
96
111
|
rainbow (>= 2.2.2, < 4.0)
|
97
|
-
|
112
|
+
regexp_parser (>= 1.8, < 3.0)
|
113
|
+
rexml (>= 3.2.5, < 4.0)
|
114
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
98
115
|
ruby-progressbar (~> 1.7)
|
99
|
-
unicode-display_width (>=
|
100
|
-
|
116
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
117
|
+
rubocop-ast (1.30.0)
|
118
|
+
parser (>= 3.2.1.0)
|
119
|
+
ruby-progressbar (1.13.0)
|
120
|
+
ruby2_keywords (0.0.5)
|
101
121
|
shellany (0.0.1)
|
102
|
-
simplecov (0.
|
122
|
+
simplecov (0.22.0)
|
103
123
|
docile (~> 1.1)
|
104
124
|
simplecov-html (~> 0.11)
|
105
|
-
|
125
|
+
simplecov_json_formatter (~> 0.1)
|
126
|
+
simplecov-html (0.12.3)
|
127
|
+
simplecov_json_formatter (0.1.4)
|
106
128
|
terminal-notifier-guard (1.7.0)
|
107
|
-
thor (1.0
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
yard (0.9.24)
|
113
|
-
zeitwerk (2.3.0)
|
129
|
+
thor (1.3.0)
|
130
|
+
tzinfo (2.0.6)
|
131
|
+
concurrent-ruby (~> 1.0)
|
132
|
+
unicode-display_width (2.5.0)
|
133
|
+
yard (0.9.34)
|
114
134
|
|
115
135
|
PLATFORMS
|
116
136
|
ruby
|
117
137
|
|
118
138
|
DEPENDENCIES
|
139
|
+
activesupport (>= 6.1.4)
|
119
140
|
bundler (~> 2.1.4)
|
120
141
|
easy_time!
|
121
142
|
fuubar (>= 2.5.0)
|
data/README.md
CHANGED
@@ -15,10 +15,10 @@ Well, then, give EasyTime a try!
|
|
15
15
|
|
16
16
|
`EasyTime` accepts most of the well-known date and time objects, including
|
17
17
|
`RFC2822`, `HTTPDate`, `XMLSchema`, `ISO8601`, as well as
|
18
|
-
ActiveSupport::TimeWithZone strings and provides comparisons that have an
|
18
|
+
`ActiveSupport::TimeWithZone` strings and provides comparisons that have an
|
19
19
|
adjustable tolerance. With `EasyTime` methods, you can reliably compare two
|
20
20
|
timestamps and determine which one is "newer", "older" or the "same" withing
|
21
|
-
a configurable tolerance. The default comparison tolerance is 1.minute
|
21
|
+
a configurable tolerance. The default comparison tolerance is `1.minute`.
|
22
22
|
|
23
23
|
In other words, if you have a time-stamp from an `ActiveRecord` object that is
|
24
24
|
a few seconds different from a related object obtained from a 3rd-party system,
|
@@ -135,8 +135,8 @@ A `String` value is parsed with the `convert` method.
|
|
135
135
|
|
136
136
|
#### Time Strings
|
137
137
|
|
138
|
-
Most modern time format strings are recognized: ISO8601
|
139
|
-
XMLSchema
|
138
|
+
Most modern time format strings are recognized: `ISO8601`, `RFD2822`, `HTTPDate`,
|
139
|
+
`XMLSchema`, and even some natural date and time formats. Many systems use an
|
140
140
|
[ISO8601](https://en.wikipedia.org/wiki/ISO_8601) string, which has date, time,
|
141
141
|
and timezone components, with each variant having some variations.
|
142
142
|
|
@@ -204,9 +204,9 @@ applied across all instances of the class.
|
|
204
204
|
|
205
205
|
### EasyTime Instance Methods
|
206
206
|
|
207
|
-
Once
|
208
|
-
where the comparison methods are overridden in order to apply the
|
209
|
-
tolerance value.
|
207
|
+
Once an `EasyTime` value has been created, it is basically a wrapped `Time`
|
208
|
+
value where the comparison methods are overridden in order to apply the
|
209
|
+
comparison tolerance value.
|
210
210
|
|
211
211
|
These are the instance methods:
|
212
212
|
|
@@ -318,9 +318,9 @@ simple to review the gem API documentation:
|
|
318
318
|
|
319
319
|
## Contributing
|
320
320
|
|
321
|
-
If you wish to contribute, please fork the repo, create a new branch for your
|
322
|
-
improvement, and create a pull request based off of your forked repo
|
323
|
-
not make changes in the version.
|
321
|
+
If you wish to contribute, please fork the repo, create a new branch for your
|
322
|
+
suggested improvement, and create a pull request based off of your forked repo
|
323
|
+
branch. Please do not make changes in the version.
|
324
324
|
|
325
325
|
Bug reports and pull requests are welcome on GitHub at https://github.com/aks/easy_time.
|
326
326
|
|
data/easy_time.gemspec
CHANGED
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
30
30
|
|
31
31
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
32
|
+
# spec.metadata["allowed_push_host"] = "https://rubygems.pkg.github.com/aks"
|
33
|
+
spec.metadata["github_repo"] = "ssh://github.com/aks/easy_time"
|
32
34
|
|
33
35
|
spec.metadata["homepage_uri"] = spec.homepage
|
34
36
|
spec.metadata["source_code_uri"] = "https://github.com/aks/easy_time"
|
@@ -43,6 +45,7 @@ Gem::Specification.new do |spec|
|
|
43
45
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
44
46
|
spec.require_paths = ["lib"]
|
45
47
|
|
48
|
+
spec.add_development_dependency "activesupport", ">= 6.1.4"
|
46
49
|
spec.add_development_dependency "bundler", "~> 2.1.4"
|
47
50
|
spec.add_development_dependency "fuubar", ">= 2.5.0"
|
48
51
|
spec.add_development_dependency "guard"
|
data/lib/easy_time/version.rb
CHANGED
data/lib/easy_time.rb
CHANGED
@@ -212,17 +212,17 @@ class EasyTime
|
|
212
212
|
new(parse_string(time_string))
|
213
213
|
end
|
214
214
|
|
215
|
-
def method_missing(
|
216
|
-
if Time.respond_to?(
|
217
|
-
value = Time.send(
|
215
|
+
def method_missing(symbol, *args, &block)
|
216
|
+
if Time.respond_to?(symbol)
|
217
|
+
value = Time.send(symbol, *args, &block)
|
218
218
|
is_a_time?(value) ? new(value) : value
|
219
219
|
else
|
220
|
-
super
|
220
|
+
super(symbol, *args, &block)
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
|
-
def respond_to_missing?(
|
225
|
-
Time.respond_to?(
|
224
|
+
def respond_to_missing?(symbol, include_all=false)
|
225
|
+
Time.respond_to?(symbol, include_all)
|
226
226
|
end
|
227
227
|
|
228
228
|
# @param value [Anything] value to test as a time-like object
|
@@ -246,7 +246,7 @@ class EasyTime
|
|
246
246
|
delegate :to_s, :inspect, to: :time
|
247
247
|
|
248
248
|
def initialize(*time, tolerance: nil)
|
249
|
-
@time = time.
|
249
|
+
@time = time.size.nonzero? && convert(time.size == 1 ? time.first : time)
|
250
250
|
@comparison_tolerance = tolerance
|
251
251
|
end
|
252
252
|
|
@@ -381,17 +381,17 @@ class EasyTime
|
|
381
381
|
end
|
382
382
|
|
383
383
|
# intercept any time methods so they can wrap the time-like result in a new EasyTime object.
|
384
|
-
def method_missing(
|
385
|
-
if time.respond_to?(
|
386
|
-
value = time.send(
|
384
|
+
def method_missing(symbol, *args, &block)
|
385
|
+
if time.respond_to?(symbol)
|
386
|
+
value = time.send(symbol, *args, &block)
|
387
387
|
is_a_time?(value) ? dup.tap { |eztime| eztime.time = value } : value
|
388
388
|
else
|
389
|
-
super
|
389
|
+
super(symbol, *args, &block)
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
393
|
-
def respond_to_missing?(
|
394
|
-
time.respond_to?(
|
393
|
+
def respond_to_missing?(symbol, include_all=false)
|
394
|
+
time.respond_to?(symbol, include_all)
|
395
395
|
end
|
396
396
|
|
397
397
|
def is_a_time?(value)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Stebbens
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.4
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.1.4
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,6 +277,7 @@ files:
|
|
263
277
|
- ".rubocop.yml"
|
264
278
|
- ".travis.yml"
|
265
279
|
- ".yardopts"
|
280
|
+
- CHANGELOG.md
|
266
281
|
- Gemfile
|
267
282
|
- Gemfile.lock
|
268
283
|
- Guardfile
|
@@ -280,9 +295,10 @@ licenses:
|
|
280
295
|
- MIT
|
281
296
|
metadata:
|
282
297
|
allowed_push_host: https://rubygems.org
|
298
|
+
github_repo: ssh://github.com/aks/easy_time
|
283
299
|
homepage_uri: https://github.com/aks/easy_time
|
284
300
|
source_code_uri: https://github.com/aks/easy_time
|
285
|
-
post_install_message:
|
301
|
+
post_install_message:
|
286
302
|
rdoc_options: []
|
287
303
|
require_paths:
|
288
304
|
- lib
|
@@ -297,8 +313,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
313
|
- !ruby/object:Gem::Version
|
298
314
|
version: '0'
|
299
315
|
requirements: []
|
300
|
-
rubygems_version: 3.1.
|
301
|
-
signing_key:
|
316
|
+
rubygems_version: 3.1.6
|
317
|
+
signing_key:
|
302
318
|
specification_version: 4
|
303
319
|
summary: Easy auto-conversion of most date and time values with tolerant-comparisons
|
304
320
|
test_files: []
|
321
|
+
...
|