bindata 2.4.6 → 2.4.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bindata might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c4dad8d006c1df84f2f6e241e0309a6efdd41622e9d4469b72c5f4ab23c681f
4
- data.tar.gz: 649973630d5544a6aa50185f20006d77ff75349d67448fe7b32b66417de87359
3
+ metadata.gz: 9be5b49e663e2525dfc786351b811954d2069d17796271f39dd2e6023b42b25b
4
+ data.tar.gz: d3f43e1edb07968d56ad0ae8afb6db509ac234670cd5695a8e6f3ea4ef1f24f0
5
5
  SHA512:
6
- metadata.gz: 769971878d5575cb15cdab697ef7226f8e43c4a932e0f52fad91eaf32cbfeda2d8d027e10fb5be2498a6af2389b9bfe60aea0d1a11496303f0f5c55fdc582b0a
7
- data.tar.gz: d623fe3a282df4a2fd68cc9235225ec56338ea0e02ffd6c659e797fd4369d651cd9087fc1457197546a2e05c149b9608f4686ebf58a850215be40588c76d69dd
6
+ metadata.gz: 19f3a5d4f957c8136048df08132f3db8445e85c5cf894f046840724ff712ee656ecd1c0c40e962a90d00deae2af901b9aae7909e99ad68c91e9d1d133ead29dd
7
+ data.tar.gz: 162b363f3618ba5f89bdd5f8018e948d726ae52e153339fbd8071c9aefeedbd3a88146a987424871799949033047e02658eee8c0671bc17e5f9f0d8b9af3e9ae
@@ -1,5 +1,9 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.7 (2020-03-31)
4
+
5
+ * Fix choice assignment inside arrays. Reported by Spencer McIntyre.
6
+
3
7
  == Version 2.4.6 (2020-02-27)
4
8
 
5
9
  * More encoding fixes. Thanks to Aaron Patterson.
@@ -82,7 +82,8 @@ module BinData
82
82
  def assign(array)
83
83
  raise ArgumentError, "can't set a nil value for #{debug_name}" if array.nil?
84
84
 
85
- @element_list = to_storage_formats(array.to_ary)
85
+ @element_list = []
86
+ concat(array)
86
87
  end
87
88
 
88
89
  def snapshot
@@ -119,7 +120,17 @@ module BinData
119
120
 
120
121
  def insert(index, *objs)
121
122
  extend_array(index - 1)
122
- elements.insert(index, *to_storage_formats(objs))
123
+ abs_index = (index >= 0) ? index : index + 1 + length
124
+
125
+ # insert elements before...
126
+ new_elements = objs.map { new_element }
127
+ elements.insert(index, *new_elements)
128
+
129
+ # ...assigning values
130
+ objs.each_with_index do |obj, i|
131
+ self[abs_index + i] = obj
132
+ end
133
+
123
134
  self
124
135
  end
125
136
 
@@ -238,10 +249,6 @@ module BinData
238
249
  end
239
250
  end
240
251
 
241
- def to_storage_formats(els)
242
- els.collect { |el| new_element(el) }
243
- end
244
-
245
252
  def elements
246
253
  @element_list ||= []
247
254
  end
@@ -252,8 +259,8 @@ module BinData
252
259
  element
253
260
  end
254
261
 
255
- def new_element(value = nil)
256
- @element_prototype.instantiate(value, self)
262
+ def new_element
263
+ @element_prototype.instantiate(nil, self)
257
264
  end
258
265
 
259
266
  def sum_num_bytes_for_all_elements
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.6"
2
+ VERSION = "2.4.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bindata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.6
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake