timerage 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/timerage/time_interval.rb +5 -6
- data/lib/timerage/version.rb +1 -1
- data/spec/timerage/time_interval_spec.rb +7 -1
- data/timerage.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e2b0e89fc0f24f9a2d8216d867b9d7d8f9477c4b449bc43c9d5287c4e24057c7
|
4
|
+
data.tar.gz: b6a3376136ad56501316b735da77c3ba8667803fd80f3a8812e941cf0f8dbbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157b9c3a249183f8e8b4247332b5be02578899bf1c6d67e84853d161950bd09894d87098676eed4f71ced7a1e23d33e0c27168fdc27570a020e2774110664e75
|
7
|
+
data.tar.gz: 131e7dbf90167eeaf21935d246327283da94371ffa40c27ee36577317daf7a92d91049acde3a4bfe6f48eaa87cdebf2cd596889e68983523fd6992a03e6d1ae9
|
@@ -6,7 +6,7 @@ module Timerage
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def new(*args)
|
9
|
-
args = [args.first.begin, args.first.end, args.first.exclude_end?] if args.first.respond_to?(:exclude_end?)
|
9
|
+
args = [args.first.begin, args.first.end, args.first.exclude_end?] if args.first.respond_to?(:exclude_end?)
|
10
10
|
new_obj = allocate
|
11
11
|
new_obj.send(:initialize, *args)
|
12
12
|
new_obj
|
@@ -135,13 +135,12 @@ module Timerage
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def time_enumerator(step)
|
138
|
-
|
139
|
-
count -= 1 if exclude_end? and (self.end - self.begin) % step == 0
|
140
|
-
# We've included our end if it should be
|
138
|
+
next_offset = 0.seconds
|
141
139
|
|
142
140
|
Enumerator.new do |y|
|
143
|
-
(
|
144
|
-
y << self.begin +
|
141
|
+
while self.cover?(self.begin + next_offset)
|
142
|
+
y << self.begin + next_offset
|
143
|
+
next_offset += step
|
145
144
|
end
|
146
145
|
end
|
147
146
|
end
|
data/lib/timerage/version.rb
CHANGED
@@ -47,7 +47,13 @@ describe Timerage::TimeInterval do
|
|
47
47
|
specify { expect(interval.to_time).to (be >= interval.begin)
|
48
48
|
.and (be <= interval.end) }
|
49
49
|
specify { expect{|b| interval.step(1200, &b) }
|
50
|
-
|
50
|
+
.to yield_control.at_least(:once) }
|
51
|
+
|
52
|
+
specify { expect{|b|
|
53
|
+
Timerage(Time.parse("2019-08-01 01:00:00 UTC")...Time.parse("2019-09-01 01:00:00 UTC"))
|
54
|
+
.step(1.month, &b)
|
55
|
+
}.to yield_control.exactly(:once) }
|
56
|
+
|
51
57
|
specify { expect(interval.iso8601)
|
52
58
|
.to eq "#{interval.begin.iso8601}/#{interval.end.iso8601}" }
|
53
59
|
specify { expect(interval.iso8601(3))
|
data/timerage.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~>
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec", ["> 3.0.0.a", "< 4"]
|
24
24
|
spec.add_development_dependency "activesupport"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timerage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.4.5
|
114
|
+
rubygems_version: 3.0.3
|
116
115
|
signing_key:
|
117
116
|
specification_version: 4
|
118
117
|
summary: Simple refinement to Range to allow Time or Date as arguments
|