voldemort-rb 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/voldemort-serializer.rb +12 -12
  2. metadata +4 -13
@@ -10,8 +10,8 @@ class VoldemortJsonBinarySerializer
10
10
  SHORT_MAX_VAL = 2 ** 15 - 1
11
11
  INT_MIN_VAL = -2147483648
12
12
  LONG_MIN_VAL = -9223372036854775808
13
- FLOAT_MIN_VAL = 2 ** -149
14
- DOUBLE_MIN_VAL = 2 ** -1074
13
+ FLOAT_MIN_VAL = 2.0 ** -149
14
+ DOUBLE_MIN_VAL = 2.0 ** -1074
15
15
 
16
16
  def initialize(type_def_versions)
17
17
  @has_version = true
@@ -137,7 +137,7 @@ class VoldemortJsonBinarySerializer
137
137
  bytes = ''
138
138
 
139
139
  if(object == BYTE_MIN_VAL)
140
- # TODO throw underflow exception
140
+ raise "Can't use '#{BYTE_MIN_VAL}' because it is used to represent nil"
141
141
  else
142
142
  if(object == nil)
143
143
  object = BYTE_MIN_VAL
@@ -153,7 +153,7 @@ class VoldemortJsonBinarySerializer
153
153
  bytes = ''
154
154
 
155
155
  if(object == SHORT_MIN_VAL)
156
- # TODO throw underflow exception
156
+ raise "Can't use '#{SHORT_MIN_VAL}' because it is used to represent nil"
157
157
  else
158
158
  if(object == nil)
159
159
  object = SHORT_MIN_VAL
@@ -169,7 +169,7 @@ class VoldemortJsonBinarySerializer
169
169
  bytes = ''
170
170
 
171
171
  if(object == INT_MIN_VAL)
172
- # TODO throw underflow exception
172
+ raise "Can't use '#{INT_MIN_VAL}' because it is used to represent nil"
173
173
  else
174
174
  if(object == nil)
175
175
  object = INT_MIN_VAL
@@ -187,7 +187,7 @@ class VoldemortJsonBinarySerializer
187
187
  bytes = ''
188
188
 
189
189
  if(object == LONG_MIN_VAL)
190
- # TODO throw underflow exception
190
+ raise "Can't use '#{LONG_MIN_VAL}' because it is used to represent nil"
191
191
  else
192
192
  if(object == nil)
193
193
  object = LONG_MIN_VAL
@@ -205,7 +205,7 @@ class VoldemortJsonBinarySerializer
205
205
  bytes = ''
206
206
 
207
207
  if(object == FLOAT_MIN_VAL)
208
- # TODO throw underflow exception
208
+ raise "Can't use '#{FLOAT_MIN_VAL}' because it is used to represent nil"
209
209
  else
210
210
  if(object == nil)
211
211
  object = FLOAT_MIN_VAL
@@ -221,7 +221,7 @@ class VoldemortJsonBinarySerializer
221
221
  bytes = ''
222
222
 
223
223
  if(object == DOUBLE_MIN_VAL)
224
- # TODO throw underflow exception
224
+ raise "Can't use '#{DOUBLE_MIN_VAL}' because it is used to represent nil"
225
225
  else
226
226
  if(object == nil)
227
227
  object = DOUBLE_MIN_VAL
@@ -237,7 +237,7 @@ class VoldemortJsonBinarySerializer
237
237
  bytes = ''
238
238
 
239
239
  if(object == LONG_MIN_VAL)
240
- # TODO throw underflow exception
240
+ raise "Can't use '#{LONG_MIN_VAL}' because it is used to represent nil"
241
241
  else
242
242
  if(object == nil)
243
243
  bytes << write_int64(nil)
@@ -258,7 +258,7 @@ class VoldemortJsonBinarySerializer
258
258
  bytes << write_int16(object.length)
259
259
  bytes << object
260
260
  else
261
- # TODO throw "length too long to serialize" exception
261
+ raise "length is too long to serialize"
262
262
  end
263
263
 
264
264
  return bytes
@@ -273,14 +273,14 @@ class VoldemortJsonBinarySerializer
273
273
  bytes << [1].pack('c')
274
274
 
275
275
  if(object.length != type.length)
276
- # TODO throw exception here.. invalid map serialization, expected: but got
276
+ raise "object length #{object.length} does not match type length #{type.length}"
277
277
  else
278
278
  type.sort.each do |type_pair|
279
279
  key = type_pair.first
280
280
  subtype = type_pair.last
281
281
 
282
282
  if(!object.has_key? key)
283
- # TODO throw "missing property exception"
283
+ raise "object is missing key '#{key}'"
284
284
  else
285
285
  bytes << write(object[key], subtype)
286
286
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voldemort-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 8
10
- version: 0.1.8
8
+ - 9
9
+ version: 0.1.9
11
10
  platform: ruby
12
11
  authors:
13
12
  - Alejandro Crosa
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-08-12 00:00:00 -07:00
17
+ date: 2011-08-15 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: ruby_protobuf
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 21
30
27
  segments:
31
28
  - 0
32
29
  - 3
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: nokogiri
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 113
46
41
  segments:
47
42
  - 1
48
43
  - 4
@@ -87,27 +82,23 @@ rdoc_options: []
87
82
  require_paths:
88
83
  - lib
89
84
  required_ruby_version: !ruby/object:Gem::Requirement
90
- none: false
91
85
  requirements:
92
86
  - - ">="
93
87
  - !ruby/object:Gem::Version
94
- hash: 3
95
88
  segments:
96
89
  - 0
97
90
  version: "0"
98
91
  required_rubygems_version: !ruby/object:Gem::Requirement
99
- none: false
100
92
  requirements:
101
93
  - - ">="
102
94
  - !ruby/object:Gem::Version
103
- hash: 3
104
95
  segments:
105
96
  - 0
106
97
  version: "0"
107
98
  requirements: []
108
99
 
109
100
  rubyforge_project:
110
- rubygems_version: 1.3.7
101
+ rubygems_version: 1.3.6
111
102
  signing_key:
112
103
  specification_version: 3
113
104
  summary: A Ruby client for the Voldemort distributed key value store