cql-rb 1.0.4 → 1.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.
@@ -101,6 +101,7 @@ module Cql
101
101
  raise @error if @error
102
102
  return @value if defined? @value
103
103
  @value_barrier.pop
104
+ @value_barrier << :ping
104
105
  raise @error if @error
105
106
  return @value
106
107
  end
@@ -108,6 +108,7 @@ module Cql
108
108
  :bigint => method(:bigint_to_bytes),
109
109
  :blob => method(:blob_to_bytes),
110
110
  :boolean => method(:boolean_to_bytes),
111
+ :counter => method(:bigint_to_bytes),
111
112
  :decimal => method(:decimal_to_bytes),
112
113
  :double => method(:double_to_bytes),
113
114
  :float => method(:float_to_bytes),
@@ -50,7 +50,7 @@ module Cql
50
50
 
51
51
  # @private
52
52
  def eql?(other)
53
- self.value == other.value
53
+ other.kind_of?(Uuid) && self.value == other.value
54
54
  end
55
55
  alias_method :==, :eql?
56
56
 
@@ -69,4 +69,4 @@ module Cql
69
69
  n
70
70
  end
71
71
  end
72
- end
72
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cql
4
- VERSION = '1.0.4'.freeze
4
+ VERSION = '1.0.5'.freeze
5
5
  end
@@ -78,6 +78,17 @@ module Cql
78
78
  expect { future.value }.to raise_error('FAIL!')
79
79
  end
80
80
 
81
+ it 'allows multiple thread to block on #value until completed' do
82
+ listeners = Array.new(10) do
83
+ Thread.start do
84
+ future.value
85
+ end
86
+ end
87
+ sleep 0.1
88
+ future.complete!(:hello)
89
+ listeners.map(&:value).should == Array.new(10, :hello)
90
+ end
91
+
81
92
  it 'cannot be completed again' do
82
93
  future.complete!('bar')
83
94
  expect { future.complete!('foo') }.to raise_error(FutureError)
@@ -14,7 +14,7 @@ module Cql
14
14
  ''
15
15
  end
16
16
 
17
- TYPES = [:ascii, :bigint, :blob, :boolean, :decimal, :double, :float, :inet, :int, :text, :varchar, :timestamp, :timeuuid, :uuid, :varint].freeze
17
+ TYPES = [:ascii, :bigint, :blob, :boolean, :counter, :decimal, :double, :float, :inet, :int, :text, :varchar, :timestamp, :timeuuid, :uuid, :varint].freeze
18
18
 
19
19
  describe '#to_bytes' do
20
20
  context 'when encoding normal value' do
@@ -36,6 +36,10 @@ module Cql
36
36
  Uuid.new(276263553384940695775376958868900023510).should eql(Uuid.new('cfd66ccc-d857-4e90-b1e5-df98a3d40cd6'))
37
37
  end
38
38
 
39
+ it 'is not equal when anything other than a Uuid is passed' do
40
+ [nil, 123, 'test'].each { |v| Uuid.new(276263553384940695775376958868900023510).should_not eql(v) }
41
+ end
42
+
39
43
  it 'aliases #== to #eql?' do
40
44
  Uuid.new(276263553384940695775376958868900023510).should == Uuid.new('cfd66ccc-d857-4e90-b1e5-df98a3d40cd6')
41
45
  end
@@ -73,4 +77,4 @@ module Cql
73
77
  end
74
78
  end
75
79
  end
76
- end
80
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-06 00:00:00.000000000 Z
12
+ date: 2013-09-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A pure Ruby CQL3 driver for Cassandra
15
15
  email:
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: 16971366414174556
116
+ hash: -3554416859720559091
117
117
  requirements: []
118
118
  rubyforge_project:
119
119
  rubygems_version: 1.8.23