bare-rb 0.1.4 → 0.1.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
  SHA256:
3
- metadata.gz: c8f26e016e563ad7dbbd4770b7f9c01911f0388fc1c48f7d4b47f937cb8ce53d
4
- data.tar.gz: 5f61e5e1ff4fec292475bbdf8d14163e8b32607e6ef707c562c9a0afd29ae772
3
+ metadata.gz: 1e8e36acbdcc47dc92e23a029edf5fac7001fbec9bd4948549cc0e682ea238b0
4
+ data.tar.gz: 86ffe342e8f2ec768b6fb222fe3575dd35eda7500ee88cff7111056a8bd422d5
5
5
  SHA512:
6
- metadata.gz: f3313e886d04c612bf20b299f98c42b7e3a2f415d0db8aa502fe820f751def52e21ee1bd77e75e51bbdb687e3d7c4e01cac9c7f0350cad776c9a15e8e4ca1d25
7
- data.tar.gz: e77051e381214e378e0f9140716da5ef02bcd0757834fc69a7362221107900ce9e96c0bfc31e0dabee23bd751d465ac236a7a103d0a2c744669184baaf2a72f6
6
+ metadata.gz: 555833846daa3aa6337fb836b3a7959d656dd329c3925bceb01ab27d6f873bde95e83bf965daea90f3429c73b8659b40929f6f9e1b138a631c85966910750ee2
7
+ data.tar.gz: 0f9b6ef29fd8731c688f8507d6b141e2bb0992b0074b7118cb8b13a9263b57aad9e30becbb990c94d6cc33792abad805a3cd4a44d8deab93ee3847a8de57e68a
data/lib/bare-rb.rb CHANGED
@@ -6,8 +6,8 @@ require_relative "parser"
6
6
  class Bare
7
7
  def self.encode(msg, schema, type=nil)
8
8
  if schema.is_a?(Bare::Schema)
9
- raise NoTypeProvided("To encode with a schema as opposed to a raw type you must specify which type in the same you want to encode as a symbol.\nBare.encode(msg, schema, :Type)") if type.nil?
10
- return schema[type].encode(msg)
9
+ raise NoTypeProvided("To encode with a schema as opposed to a raw type you must specify which type in the schema you want to encode as a symbol.\nBare.encode(msg, schema, :Type)") if type.nil?
10
+ schema[type].encode(msg)
11
11
  else
12
12
  schema.encode(msg)
13
13
  end
@@ -16,9 +16,11 @@ class Bare
16
16
  def self.decode(msg, schema, type=nil)
17
17
  if schema.is_a?(Bare::Schema)
18
18
  raise NoTypeProvided("To decode with a schema as opposed to a raw type you must specify which type in the same you want to encode as a symbol.\nBare.encode(msg, schema, :Type)") if type.nil?
19
- return schema[type].decode(msg)[:value]
19
+ value, rest = schema[type].decode(msg)
20
+ value
20
21
  else
21
- schema.decode(msg)[:value]
22
+ value, rest = schema.decode(msg)
23
+ return value
22
24
  end
23
25
  end
24
26
 
@@ -34,10 +36,9 @@ class Bare
34
36
  end
35
37
 
36
38
  class Schema
37
-
38
39
  def ==(otherSchema)
39
40
  return false unless otherSchema.is_a?(Bare::Schema)
40
- return @types == otherSchema.types
41
+ @types == otherSchema.types
41
42
  end
42
43
 
43
44
  def types
@@ -54,8 +55,9 @@ class Bare
54
55
  if @types[key].is_a?(Symbol)
55
56
  @types[key] = @types[@types[key]]
56
57
  else
57
- # Users may user symbols to reference not yet defined types
58
+ # Users may use symbols to reference not yet defined types
58
59
  # here we recursively call our bare classes to finalize their types
60
+ # replacing Symbols like :SomeType with a reference to the other type
59
61
  @types[key].finalize_references(@types)
60
62
  end
61
63
  end
data/lib/exceptions.rb CHANGED
@@ -5,6 +5,12 @@ class BareException < StandardError
5
5
  end
6
6
  end
7
7
 
8
+ class FixedDataSizeWrong < BareException
9
+ def initialize(msg=nil)
10
+ super
11
+ end
12
+ end
13
+
8
14
  class NoTypeProvided < BareException
9
15
  def initialize(msg = nil)
10
16
  super
data/lib/lexer.rb CHANGED
@@ -10,48 +10,48 @@ def lexer(path)
10
10
  elsif /^\n/.match(line)
11
11
  break
12
12
  elsif /^ /.match(line)
13
- line = line[1..]
13
+ line = line[1..line.size]
14
14
  elsif /^</.match(line)
15
- line = line[1..]
15
+ line = line[1..line.size]
16
16
  tokens << :less_than
17
17
  elsif /^>/.match(line)
18
- line = line[1..]
18
+ line = line[1..line.size]
19
19
  tokens << :greater_than
20
20
  next
21
21
  elsif /^{/.match(line)
22
- line = line[1..]
22
+ line = line[1..line.size]
23
23
  tokens << :open_block
24
24
  elsif /^=/.match(line)
25
- line = line[1..]
25
+ line = line[1..line.size]
26
26
  tokens << :equal
27
27
  elsif /^}/.match(line)
28
- line = line[1..]
28
+ line = line[1..line.size]
29
29
  tokens << :close_block
30
30
  elsif /^\[/.match(line)
31
- line = line[1..]
31
+ line = line[1..line.size]
32
32
  tokens << :open_brace
33
33
  elsif /^\]/.match(line)
34
- line = line[1..]
34
+ line = line[1..line.size]
35
35
  tokens << :close_brace
36
36
  elsif /^\(/.match(line)
37
- line = line[1..]
37
+ line = line[1..line.size]
38
38
  tokens << :open_paren
39
39
  elsif /^\)/.match(line)
40
- line = line[1..]
40
+ line = line[1..line.size]
41
41
  tokens << :close_paren
42
42
  elsif /^\|/.match(line)
43
- line = line[1..]
43
+ line = line[1..line.size]
44
44
  tokens << :bar
45
45
  elsif match = /^([0-9]+)/.match(line)
46
46
  tokens << match[0].to_i
47
- line = line[(match[0].size)..]
47
+ line = line[(match[0].size)..line.size]
48
48
  next
49
49
  elsif match = /^[a-z,A-Z,_][_,a-z,A-Z,0-9]+/.match(line)
50
50
  tokens << match[0]
51
- line = line[(match[0].size)..]
51
+ line = line[(match[0].size)..line.size]
52
52
  elsif /:/.match(line)
53
53
  tokens << :colon
54
- line = line[1..]
54
+ line = line[1..line.size]
55
55
  else
56
56
  raise SchemaParsingException.new("Unable to lex line #{line_num} near #{line.inspect}")
57
57
  end
data/lib/parser.rb CHANGED
@@ -38,15 +38,15 @@ class Parser
38
38
  name = tokens[0]
39
39
  int_repr = tokens[2]
40
40
  enum_hash[int_repr] = name
41
- tokens = tokens[3..]
41
+ tokens = tokens[3..tokens.size]
42
42
  else
43
43
  enum_hash[count] = tokens[0]
44
44
  count += 1
45
- tokens = tokens[1..]
45
+ tokens = tokens[1..tokens.size]
46
46
  end
47
47
  end
48
48
  enum = Bare.Enum(enum_hash)
49
- return tokens[1..], enum
49
+ return tokens[1..tokens.size], enum
50
50
  end
51
51
 
52
52
  def parse_union(tokens)
@@ -55,13 +55,13 @@ class Parser
55
55
  # type A_UNION ( int | uint | data = 7 | f32 )
56
56
  while tokens[0] != :close_paren
57
57
  if tokens[0] == :bar
58
- tokens = tokens[1..]
58
+ tokens = tokens[1..tokens.size]
59
59
  else
60
60
  if tokens[1] == :equal
61
61
  raise SchemaParsingException.new("Equals sign in union must be followed by a number") unless tokens[2].is_a?(Numeric)
62
62
  count = tokens[2]
63
63
  tokens, type = self.parse(tokens)
64
- tokens = tokens[2..]
64
+ tokens = tokens[2..tokens.size]
65
65
  union_hash[count] = type
66
66
  count += 1
67
67
  else
@@ -78,63 +78,63 @@ class Parser
78
78
  struct_fields = {}
79
79
  while tokens.size >= 2 and tokens[1] == :colon
80
80
  name = tokens[0]
81
- tokens, type = self.parse(tokens[2..])
81
+ tokens, type = self.parse(tokens[2..tokens.size])
82
82
  struct_fields[name.to_sym] = type
83
83
  end
84
- return tokens[1..], struct_fields
84
+ return tokens[1..tokens.size], struct_fields
85
85
  end
86
86
 
87
87
  def parse(tokens)
88
88
  while tokens.size > 0
89
89
  if tokens[0] == "type"
90
90
  name = tokens[1]
91
- tokens, type = self.parse(tokens[2..])
91
+ tokens, type = self.parse(tokens[2..tokens.size])
92
92
  @definitions[name.to_sym] = type
93
93
  elsif tokens[0] == "map"
94
94
  raise SchemaParsingException.new("Map must be followed by a '[' eg. map[string]data") if tokens[1] != :open_brace
95
- tokens, map_from_type = parse(tokens[2..])
95
+ tokens, map_from_type = parse(tokens[2..tokens.size])
96
96
  raise SchemaParsingException.new("Map to type must be followed by a ']' eg. map[string]data") if tokens[0] != :close_brace
97
- tokens, map_to_type = parse(tokens[1..])
97
+ tokens, map_to_type = parse(tokens[1..tokens.size])
98
98
  return tokens, Bare.Map(map_from_type, map_to_type)
99
99
  elsif tokens[0] == "data" && tokens.size > 3 && tokens[1] == :less_than
100
100
  raise SchemaParsingException.new("data< must be followed by a number for a fixed sized bare data") unless tokens[2].is_a?(Numeric)
101
101
  raise SchemaParsingException.new("data<# must be followed by a >") unless tokens[3] == :greater_than
102
- return tokens[4..], Bare.DataFixedLen(tokens[2])
102
+ return tokens[4..tokens.size], Bare.DataFixedLen(tokens[2])
103
103
  elsif tokens[0] == "enum"
104
104
  name = tokens[1]
105
105
  raise SchemaParsingException.new("Enum must be followed by a '{'") if tokens[2] != :open_block
106
- tokens, enum = parse_enum(tokens[3..])
106
+ tokens, enum = parse_enum(tokens[3..tokens.size])
107
107
  @definitions[name.to_sym] = enum
108
108
  elsif tokens[0] == "optional"
109
109
  raise SchemaParsingException.new("Optional must be followed by a '< TYPE > you are missing the first <'") if tokens[1] != :less_than
110
- tokens, optional_type = self.parse(tokens[2..])
110
+ tokens, optional_type = self.parse(tokens[2..tokens.size])
111
111
  raise SchemaParsingException.new("Optional must be followed by a '< TYPE >' you are missing the last >") if tokens[0] != :greater_than
112
- return tokens[1..], Bare.Optional(optional_type)
112
+ return tokens[1..tokens.size], Bare.Optional(optional_type)
113
113
  elsif tokens[0] == :open_brace
114
114
  if tokens[1].is_a?(Numeric)
115
115
  size = tokens[1]
116
116
  raise SchemaParsingException.new("Fixed Length Array size must be followed by a ']'") if tokens[2] != :close_brace
117
- tokens, arr_type = parse(tokens[3..])
117
+ tokens, arr_type = parse(tokens[3..tokens.size])
118
118
  return tokens, Bare.ArrayFixedLen(arr_type, size)
119
119
  else
120
- tokens, arr_type = parse(tokens[2..])
120
+ tokens, arr_type = parse(tokens[2..tokens.size])
121
121
  return tokens, Bare.Array(arr_type)
122
122
  end
123
123
  elsif tokens[0] == :open_paren
124
- tokens, union_hash = parse_union(tokens[1..])
124
+ tokens, union_hash = parse_union(tokens[1..tokens.size])
125
125
  raise SchemaParsingException.new("Union must be followed by a ')'") if tokens[0] != :close_paren
126
- return tokens[1..], Bare.Union(union_hash)
126
+ return tokens[1..tokens.size], Bare.Union(union_hash)
127
127
  elsif tokens[0] == :open_block
128
- tokens, struct_fields = parse_struct(tokens[1..])
128
+ tokens, struct_fields = parse_struct(tokens[1..tokens.size])
129
129
  strct = Bare.Struct(struct_fields)
130
130
  return tokens, strct
131
131
  elsif @primitives.include?(tokens[0])
132
132
  type = @primitives[tokens[0]]
133
- return tokens[1..], type
133
+ return tokens[1..tokens.size], type
134
134
  elsif @definitions.keys.include?(tokens[0].to_sym) # User defined type
135
- return tokens[1..], @definitions[tokens[0].to_sym]
135
+ return tokens[1..tokens.size], @definitions[tokens[0].to_sym]
136
136
  elsif tokens[0].is_a?(String) && tokens[0][0].upcase == tokens[0][0] # Not yet defined user type
137
- return tokens[1..], tokens[0].to_sym
137
+ return tokens[1..tokens.size], tokens[0].to_sym
138
138
  else
139
139
  raise SchemaParsingException.new("Unable to parse token: #{tokens[0]}")
140
140
  end
data/lib/types.rb CHANGED
@@ -10,6 +10,7 @@ class BareTypes
10
10
  end
11
11
 
12
12
  class BarePrimitive < BaseType
13
+
13
14
  # Types which are always equivalent to another instantiation of themselves
14
15
  # Eg. Uint.new == Uint.new
15
16
  # But Union.new(types1) != Union.new(types2)
@@ -33,10 +34,9 @@ class BareTypes
33
34
  end
34
35
 
35
36
  def decode(msg)
36
- output = Uint.new.decode(msg)
37
- unmapped = output[:value]
38
- unmapped = unmapped.odd? ? (unmapped + 1) / -2 : unmapped / 2
39
- return {value: unmapped, rest: output[:rest]}
37
+ value, rest = Uint.new.decode(msg)
38
+ value = value.odd? ? (value + 1) / -2 : value / 2
39
+ return value, rest
40
40
  end
41
41
  end
42
42
 
@@ -46,17 +46,17 @@ class BareTypes
46
46
  end
47
47
 
48
48
  def decode(msg)
49
- return {value: nil, rest: msg}
49
+ return nil, msg
50
50
  end
51
51
  end
52
52
 
53
53
  class F32 < BarePrimitive
54
54
  def encode(msg)
55
- return [msg].pack("e")
55
+ [msg].pack("e")
56
56
  end
57
57
 
58
58
  def decode(msg)
59
- return {value: msg.unpack("e")[0], rest: msg[4..msg.size]}
59
+ return msg.unpack("e")[0], msg[4..msg.size]
60
60
  end
61
61
  end
62
62
 
@@ -66,7 +66,7 @@ class BareTypes
66
66
  end
67
67
 
68
68
  def decode(msg)
69
- return {value: msg.unpack("E")[0], rest: msg[8..msg.size]}
69
+ return msg.unpack("E")[0], msg[8..msg.size]
70
70
  end
71
71
  end
72
72
 
@@ -84,10 +84,9 @@ class BareTypes
84
84
  end
85
85
 
86
86
  def decode(msg)
87
- output = Uint.new.decode(msg)
88
- strLen = output[:value]
89
- string = output[:rest][0..strLen - 1]
90
- return {value: string.force_encoding("utf-8"), rest: output[:rest][strLen..output[:rest].size]}
87
+ strLen, rest = Uint.new.decode(msg)
88
+ string = rest[0..strLen - 1]
89
+ return string.force_encoding("utf-8"), rest[strLen..rest.size]
91
90
  end
92
91
  end
93
92
 
@@ -119,7 +118,7 @@ class BareTypes
119
118
  if msg.nil?
120
119
  return "\x00".b
121
120
  else
122
- bytes = "\xFF".b
121
+ bytes = "\x01".b
123
122
  bytes << @optionalType.encode(msg)
124
123
  return bytes
125
124
  end
@@ -127,7 +126,7 @@ class BareTypes
127
126
 
128
127
  def decode(msg)
129
128
  if msg.unpack("C")[0] == 0
130
- return {value: nil, rest: msg[1..msg.size]}
129
+ return nil, msg[1..msg.size]
131
130
  else
132
131
  return @optionalType.decode(msg[1..msg.size])
133
132
  end
@@ -179,15 +178,13 @@ class BareTypes
179
178
 
180
179
  def decode(msg)
181
180
  hash = Hash.new
182
- output = Uint.new.decode(msg)
183
- mapSize = output[:value]
181
+ mapSize, rest = Uint.new.decode(msg)
184
182
  (mapSize - 1).to_i.downto(0) do
185
- output = @from.decode(output[:rest])
186
- key = output[:value]
187
- output = @to.decode(output[:rest])
188
- hash[key] = output[:value]
183
+ key, rest = @from.decode(rest)
184
+ value, rest = @to.decode(rest)
185
+ hash[key] = value
189
186
  end
190
- return {value: hash, rest: output[:rest]}
187
+ return hash, rest
191
188
  end
192
189
  end
193
190
 
@@ -244,11 +241,10 @@ class BareTypes
244
241
  end
245
242
 
246
243
  def decode(msg)
247
- unionTypeInt = Uint.new.decode(msg)
248
- int = unionTypeInt[:value]
244
+ int, rest = Uint.new.decode(msg)
249
245
  type = @intToType[int]
250
- value = type.decode(unionTypeInt[:rest])
251
- return {value: {value: value[:value], type: type}, rest: value[:rest]}
246
+ value, rest = type.decode(rest)
247
+ return {value: value, type: type}, rest
252
248
  end
253
249
  end
254
250
 
@@ -270,11 +266,14 @@ class BareTypes
270
266
  end
271
267
 
272
268
  def encode(msg)
273
- return msg
269
+ if msg.size != @length
270
+ raise FixedDataSizeWrong.new("Message is not proper sized for DataFixedLen should have been #{@length} but was #{msg.size}")
271
+ end
272
+ msg
274
273
  end
275
274
 
276
275
  def decode(msg)
277
- return {value: msg[0..@length], rest: msg[@length..msg.size]}
276
+ return msg[0..@length], msg[@length..msg.size]
278
277
  end
279
278
  end
280
279
 
@@ -290,10 +289,8 @@ class BareTypes
290
289
  end
291
290
 
292
291
  def decode(msg)
293
- output = Uint.new.decode(msg)
294
- rest = output[:rest]
295
- dataSize = output[:value]
296
- return {value: rest[0..dataSize - 1], rest: rest[dataSize..]}
292
+ dataSize, rest = Uint.new.decode(msg)
293
+ return rest[0..dataSize - 1], rest[dataSize..rest.size]
297
294
  end
298
295
  end
299
296
 
@@ -320,7 +317,7 @@ class BareTypes
320
317
  end
321
318
 
322
319
  def decode(msg)
323
- ints = msg.unpack("CCCCCCCCC")
320
+ ints = msg.unpack("CCCCCCCC")
324
321
  relevantInts = []
325
322
  i = 0
326
323
  while ints[i] & 0b10000000 == 128
@@ -332,7 +329,7 @@ class BareTypes
332
329
  relevantInts.each_with_index do |int, idx|
333
330
  sum += int << (idx * 7)
334
331
  end
335
- return {value: sum, rest: msg[(i + 1)..msg.size]}
332
+ return sum, msg[(i + 1)..msg.size]
336
333
  end
337
334
  end
338
335
 
@@ -342,7 +339,7 @@ class BareTypes
342
339
  end
343
340
 
344
341
  def decode(msg)
345
- return {value: msg[0].unpack("C")[0], rest: msg[1..msg.size]}
342
+ return msg[0].unpack("C")[0], msg[1..msg.size]
346
343
  end
347
344
  end
348
345
 
@@ -352,7 +349,7 @@ class BareTypes
352
349
  end
353
350
 
354
351
  def decode(msg)
355
- return {value: msg.unpack("v")[0], rest: msg[2..msg.size]}
352
+ return msg.unpack("v")[0], msg[2..msg.size]
356
353
  end
357
354
  end
358
355
 
@@ -362,7 +359,7 @@ class BareTypes
362
359
  end
363
360
 
364
361
  def decode(msg)
365
- return {value: msg.unpack("V")[0], rest: msg[4..msg.size]}
362
+ return msg.unpack("V")[0], msg[4..msg.size]
366
363
  end
367
364
  end
368
365
 
@@ -372,7 +369,7 @@ class BareTypes
372
369
  end
373
370
 
374
371
  def decode(msg)
375
- return {value: msg.unpack("Q")[0], rest: [8..msg.size]}
372
+ return msg.unpack("Q")[0], msg[8..msg.size]
376
373
  end
377
374
  end
378
375
 
@@ -382,7 +379,7 @@ class BareTypes
382
379
  end
383
380
 
384
381
  def decode(msg)
385
- return {value: msg[0].unpack("c")[0], rest: msg[1..msg.size]}
382
+ return msg[0].unpack("c")[0], msg[1..msg.size]
386
383
  end
387
384
  end
388
385
 
@@ -392,7 +389,7 @@ class BareTypes
392
389
  end
393
390
 
394
391
  def decode(msg)
395
- return {value: msg.unpack('s<')[0], rest: msg[2..msg.size]}
392
+ return msg.unpack('s<')[0], msg[2..msg.size]
396
393
  end
397
394
  end
398
395
 
@@ -402,7 +399,7 @@ class BareTypes
402
399
  end
403
400
 
404
401
  def decode(msg)
405
- return {value: msg.unpack('l<')[0], rest: msg[4..msg.size]}
402
+ return msg.unpack('l<')[0], msg[4..msg.size]
406
403
  end
407
404
  end
408
405
 
@@ -412,7 +409,7 @@ class BareTypes
412
409
  end
413
410
 
414
411
  def decode(msg)
415
- return {value: msg.unpack('q<')[0], rest: msg[8..msg.size]}
412
+ return msg.unpack('q<')[0], msg[8..msg.size]
416
413
  end
417
414
  end
418
415
 
@@ -422,7 +419,7 @@ class BareTypes
422
419
  end
423
420
 
424
421
  def decode(msg)
425
- return {value: msg == "\x00\x00" ? false : true, rest: msg[1..msg.size]}
422
+ return (msg == "\x00\x00" ? false : true), msg[1..msg.size]
426
423
  end
427
424
  end
428
425
 
@@ -483,11 +480,10 @@ class BareTypes
483
480
  hash = Hash.new
484
481
  rest = msg
485
482
  @mapping.keys.each do |symbol|
486
- output = @mapping[symbol].decode(rest)
487
- hash[symbol] = output[:value]
488
- rest = output[:rest]
483
+ value, rest = @mapping[symbol].decode(rest)
484
+ hash[symbol] = value
489
485
  end
490
- return {value: hash, rest: rest}
486
+ return hash, rest
491
487
  end
492
488
  end
493
489
 
@@ -524,17 +520,16 @@ class BareTypes
524
520
  end
525
521
 
526
522
  def decode(msg)
527
- output = Uint.new.decode(msg)
528
523
  arr = []
529
- arrayLen = output[:value]
524
+ arrayLen, rest = Uint.new.decode(msg)
530
525
  lastSize = msg.size + 1 # Make sure msg size monotonically decreasing
531
526
  (arrayLen - 1).downto(0) do
532
- output = @type.decode(output[:rest])
533
- arr << output[:value]
534
- break if output[:rest].nil? || output[:rest].size == 0 || lastSize <= output[:rest].size
535
- lastSize = output[:rest].size
527
+ arrVal, rest = @type.decode(rest)
528
+ arr << arrVal
529
+ break if rest.nil? || rest.size == 0 || lastSize <= rest.size
530
+ lastSize = rest.size
536
531
  end
537
- return {value: arr, rest: output[:rest]}
532
+ return arr, rest
538
533
  end
539
534
  end
540
535
 
@@ -577,15 +572,13 @@ class BareTypes
577
572
  return bytes
578
573
  end
579
574
 
580
- def decode(msg)
575
+ def decode(rest)
581
576
  array = []
582
- rest = msg
583
577
  @size.times do
584
- output = @type.decode(rest)
585
- rest = output[:rest]
586
- array << output[:value]
578
+ arrVal, rest = @type.decode(rest)
579
+ array << arrVal
587
580
  end
588
- return {value: array, rest: rest}
581
+ return array, rest
589
582
  end
590
583
  end
591
584
 
@@ -627,10 +620,8 @@ class BareTypes
627
620
  end
628
621
 
629
622
  def decode(msg)
630
- output = BareTypes::Uint.new.decode(msg)
631
- value = output[:value]
632
- rest = output[:rest]
633
- return {value: @intToVal[value], rest: rest}
623
+ value, rest = BareTypes::Uint.new.decode(msg)
624
+ return @intToVal[value], rest
634
625
  end
635
626
  end
636
627
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bare-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Tracy-Amoroso
@@ -11,7 +11,7 @@ cert_chain: []
11
11
  date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The first implementation of the BARE (Binary Application Record Encoding)
14
- in Ruby. Includes schema parsing!
14
+ in Ruby. Includes schema parsing and compatibility tests.
15
15
  email: n8@u.northwestern.edu
16
16
  executables: []
17
17
  extensions: []