timerage 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2b0e89fc0f24f9a2d8216d867b9d7d8f9477c4b449bc43c9d5287c4e24057c7
4
- data.tar.gz: b6a3376136ad56501316b735da77c3ba8667803fd80f3a8812e941cf0f8dbbc3
3
+ metadata.gz: '07846226e71bd754087bd3b54c49d85a70e9d2f9b809d678351fbd685546fcb4'
4
+ data.tar.gz: e3be843301a7d7a7ea7cec902c2f4fd8152314a5cbbf4e74d8aad65ede5196ec
5
5
  SHA512:
6
- metadata.gz: 157b9c3a249183f8e8b4247332b5be02578899bf1c6d67e84853d161950bd09894d87098676eed4f71ced7a1e23d33e0c27168fdc27570a020e2774110664e75
7
- data.tar.gz: 131e7dbf90167eeaf21935d246327283da94371ffa40c27ee36577317daf7a92d91049acde3a4bfe6f48eaa87cdebf2cd596889e68983523fd6992a03e6d1ae9
6
+ metadata.gz: 76acc33ddaa358897021f20b82c4f3faffb1867469e410da6566480880c78c9524a84e39edb6c3468bfd5d49cba4d72dfe526dbd749ad6ecff66be839fcb6bc0
7
+ data.tar.gz: 96e281a1b857a002653629b4289574f4488068609f40f74b85832966a402311c88ea16f9db91080a74566ac502a7bd1468d496bb73b5095dcfbe572d09f2ec06
@@ -135,7 +135,7 @@ module Timerage
135
135
  end
136
136
 
137
137
  def time_enumerator(step)
138
- next_offset = 0.seconds
138
+ next_offset = step * 0
139
139
 
140
140
  Enumerator.new do |y|
141
141
  while self.cover?(self.begin + next_offset)
@@ -1,3 +1,3 @@
1
1
  module Timerage
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -214,6 +214,22 @@ describe Timerage::TimeInterval do
214
214
  specify { expect{ |b| subject.step(3_600, &b) }.to yield_control.exactly(2).times }
215
215
  end
216
216
 
217
+ context "When given date range" do
218
+ it "returns date objects when stepping through the range with a day duration" do
219
+ date_range = Date.new(2020, 1, 1)..Date.new(2020,1,3)
220
+ described_class.new(date_range).step(1.day) do |date|
221
+ expect(date).to be_kind_of Date
222
+ end
223
+ end
224
+
225
+ it "returns Time objects when stepping through the range with an hour duration" do
226
+ date_range = Date.new(2020, 1, 1)..Date.new(2020,1,2)
227
+ described_class.new(date_range).step(6.hours) do |date|
228
+ expect(date).to be_kind_of Time
229
+ end
230
+ end
231
+ end
232
+
217
233
  let(:leap_day) { Time.parse("2016-02-29 12:00:00 UTC") }
218
234
  let(:before_leap_day) { leap_day - 1.day }
219
235
  let(:after_leap_day) { leap_day + 1.day}
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timerage
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
8
8
  - Chris Schneider
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-08 00:00:00.000000000 Z
12
+ date: 2023-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -96,7 +96,7 @@ homepage: ''
96
96
  licenses:
97
97
  - MIT
98
98
  metadata: {}
99
- post_install_message:
99
+ post_install_message:
100
100
  rdoc_options: []
101
101
  require_paths:
102
102
  - lib
@@ -111,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.0.3
115
- signing_key:
114
+ rubygems_version: 3.2.33
115
+ signing_key:
116
116
  specification_version: 4
117
117
  summary: Simple refinement to Range to allow Time or Date as arguments
118
118
  test_files: