bindata 2.4.1 → 2.4.2

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
- SHA1:
3
- metadata.gz: 287dc21d091ca6cdda977286425d87c7613fb80e
4
- data.tar.gz: a68acaeb433ae8556e4f9768cbbc06a07e06578d
2
+ SHA256:
3
+ metadata.gz: 660228b3b8cdee82618401590015a45820a422fae8e0789d8bf4eceb89df3ee7
4
+ data.tar.gz: db1dfef8d5942a56d5a31a25fba27b28a4169433669cb3e910a3fb7236ba8a0f
5
5
  SHA512:
6
- metadata.gz: f87986492f2a430a86de20750dceb19b02321f0ad6e1b43f464f6e5e588d707342bab4ce8d6ac5e6b48d981c2fc4dc5a843d0f2943d8f01e87669f907c30065c
7
- data.tar.gz: 9cf8d01d87539990bae13edc30b5e513ec40fc6ab7667927a8adf67c382d76b58ce5bb32c706cf50cc1e4a1c8eb4158f616904d2860b0c43bcaacf8b65c9db67
6
+ metadata.gz: f4ba761be1d6e109d30961cffa4c92774fafd05fad047aa710f335d1cbd25a02c81a252e06e187ccf3864fd0453e49f2c58de4abac3504762fd60db5e32e962f
7
+ data.tar.gz: b442381a7d7a04e930edcbad4e42269d88477e8223d26dbd81a57f0620fbe325299445d06ff1ea80e9ebf11a049e99f5e38e75d1a452a68d34ca8708e1b59441
@@ -1,5 +1,9 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.2 (2018-01-31)
4
+
5
+ * Allow boolean values as parameters. Requested by Patrik Wenger.
6
+
3
7
  == Version 2.4.1 (2017-08-30)
4
8
 
5
9
  * Fix crash with String :length invoking :rel_offset. Reported by Claudius
@@ -306,9 +306,7 @@ module BinData
306
306
  end
307
307
 
308
308
  def needs_sanitizing?(key)
309
- parameter = self[key]
310
-
311
- parameter && !parameter.is_a?(SanitizedParameter)
309
+ has_key?(key) && ! self[key].is_a?(SanitizedParameter)
312
310
  end
313
311
 
314
312
  def ensure_no_nil_values
@@ -322,7 +320,7 @@ module BinData
322
320
 
323
321
  def merge_default_parameters!
324
322
  @the_class.default_parameters.each do |key, value|
325
- self[key] ||= value
323
+ self[key] = value unless has_key?(key)
326
324
  end
327
325
  end
328
326
 
@@ -278,7 +278,7 @@ module BinData
278
278
  end
279
279
 
280
280
  def method_missing(symbol, *args)
281
- self[symbol] || super
281
+ key?(symbol) ? self[symbol] : super
282
282
  end
283
283
  end
284
284
  end
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
@@ -338,3 +338,25 @@ describe BinData::Primitive, "representing a string" do
338
338
  end
339
339
  end
340
340
 
341
+ describe BinData::Record, "with boolean parameters" do
342
+ class BooleanParameterRecord < BinData::Record
343
+ default_parameter flag: true
344
+
345
+ int8 :a, value: -> { flag ? 2 : 3 }
346
+ end
347
+
348
+ it "uses default parameter" do
349
+ obj = BooleanParameterRecord.new
350
+ obj.a.must_equal 2
351
+ end
352
+
353
+ it "overrides parameter" do
354
+ obj = BooleanParameterRecord.new(flag: false)
355
+ obj.a.must_equal 3
356
+ end
357
+
358
+ it "overrides parameter with same value" do
359
+ obj = BooleanParameterRecord.new(flag: true)
360
+ obj.a.must_equal 2
361
+ end
362
+ 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.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubyforge_project: bindata
166
- rubygems_version: 2.6.8
166
+ rubygems_version: 2.6.14
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: A declarative way to read and write binary file formats