ts 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ts.rb +2 -2
- data/test/test_ts.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db5a9916d1ab3898e81acb156d564a1d17e18fa5
|
4
|
+
data.tar.gz: 431ae5e7fdc9940859744d37bedc8b121cd82f56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acbe9bc53d88e4535beac23f167b1bcada845bb529bb5571b98ee557004a4859a00c466b700f84bf15c4bf043f7e5aba0e9eb50af4cefe9807cf0276f5f5a8a0
|
7
|
+
data.tar.gz: d80c39981b0e42c721d622315fafa86efe7a961c5c9368903d7716fed491a0611463d6d3ebbcb8e4a3e3c26fc0eb96f52316cea82e6c1565a166864453fd8f08
|
data/lib/ts.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
class TS
|
8
8
|
|
9
|
-
Version = "1.0.
|
9
|
+
Version = "1.0.3"
|
10
10
|
|
11
11
|
include Enumerable
|
12
12
|
|
@@ -134,10 +134,10 @@ class TS
|
|
134
134
|
# +time+ the time boundary
|
135
135
|
def before time
|
136
136
|
idx = nearest(time)
|
137
|
+
return TS.new([]) if idx <= 0
|
137
138
|
if time_at(idx) < time
|
138
139
|
idx += 1
|
139
140
|
end
|
140
|
-
|
141
141
|
TS.new(@data[0..idx-1])
|
142
142
|
end
|
143
143
|
|
data/test/test_ts.rb
CHANGED
@@ -36,10 +36,14 @@ class TSTest < Test::Unit::TestCase
|
|
36
36
|
|
37
37
|
def test_after
|
38
38
|
assert_equal 999, @ts.after(1000).size
|
39
|
+
assert_equal 1000, @ts.after(-1).size
|
40
|
+
assert_equal 0, @ts.after(1000 * 1000 + 1).size
|
39
41
|
end
|
40
42
|
|
41
43
|
def test_before
|
42
44
|
assert_equal 1, @ts.before(2000).size
|
45
|
+
assert_equal 1000, @ts.before(1000 * 1000 + 1).size
|
46
|
+
assert_equal 0, @ts.before(0).size
|
43
47
|
end
|
44
48
|
|
45
49
|
def test_timestamps
|