drip 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: cb9ce5460519cdb4ff36540f5b10e2f7eebdc60e
4
- data.tar.gz: 9fc727bd2404beb5a46b5894b0fea1f5481c222d
3
+ metadata.gz: 920c68a3ad1044c5b61a8fa41544eb78580dd062
4
+ data.tar.gz: c709140812d178e3a70c85ca9f021dcdbe95699d
5
5
  SHA512:
6
- metadata.gz: 3bfc4ab159b3d138d0d4d1791857369827c48f2b42defb839920cb114f51c0dffb03dbf1b9fde8fd7fb493743b268db08af36c5c139866a0d42270ebd611bf34
7
- data.tar.gz: ebb5ef9839464ea1f691ef02b7bab07d0135ab0781b63ee4663411844f3dbfa6fadc10f1b8615063fa977dd32604949a4c38a4c88b944ff0b915838f3f19ff95
6
+ metadata.gz: ac7ec730c4bd447365d7b4e5745a68999daf6ba82cfaa3ea25e81ba8bb347bb5b7054a6fef98d76ea542c983a44a09dbdc4e4e9823e0eea8e9aa540ec94c9ba3
7
+ data.tar.gz: a8f7d29a011e809fd419997f39fd17c7d6db9f5176eb31d1a69f832354bf63aa49b92eeb4325ca10d003f6918b0d4e301fba27da8f5a02d140e055b6f5e561a1
@@ -514,12 +514,17 @@ class Drip
514
514
  end
515
515
 
516
516
  def latest?(key, tag)
517
- return false if @pool.empty?
517
+ return (key == 0) if @pool.empty?
518
518
  return @pool.latest?(key) unless tag
519
519
 
520
520
  lower = lower_boundary(@tag, [tag, key])
521
521
  upper = upper_boundary(@tag, [tag, INF])
522
- return lower == upper - 1
522
+
523
+ if key == 0
524
+ return lower == upper
525
+ else
526
+ return lower == upper - 1
527
+ end
523
528
  end
524
529
 
525
530
  def head_tag(n, tag)
@@ -1,3 +1,3 @@
1
1
  class Drip
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -127,6 +127,9 @@ class TestDrip < Test::Unit::TestCase
127
127
 
128
128
  def test_latest?
129
129
  key = @drip.write(:start)
130
+
131
+ assert_equal(@drip.latest?(0), true)
132
+
130
133
  10.times do |n|
131
134
  @drip.write(n)
132
135
  end
@@ -148,7 +151,8 @@ class TestDrip < Test::Unit::TestCase
148
151
  assert_equal(@drip.latest?(t1, 't1'), true)
149
152
  assert(@drip.write_if_latest([['t1', t1],
150
153
  ['t2', t2],
151
- ['t3', t3]], 'hello', 't1'))
154
+ ['t3', t3],
155
+ ['t4', 0]], 'hello', 't1'))
152
156
  assert_equal(@drip.latest?(t1, 't1'), false)
153
157
  assert_equal(@drip.write_if_latest([['t1', t1],
154
158
  ['t2', t2],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masatoshi Seki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree