bindata 2.4.4 → 2.4.5

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: bc513e5824615b4b143e4a733bd6e8290bdfa831ab111267475a167f31125bb1
4
- data.tar.gz: 93b4a5203a1d641dd1af806b769f92f8daf50644e9815d01fa2dbfec9f30bc8e
3
+ metadata.gz: 8a4db841bf592779a772cd1965118786c6004bb5460a51d5f4154207970f2016
4
+ data.tar.gz: dfebc39f1f2a3089d491050da6a58997401ac194f1cc3ef5602ff82a6a6554bb
5
5
  SHA512:
6
- metadata.gz: 88c701264083edfa92d193c33d394f7cb4bdc2f12722089ff27bb296bad28665f8e28a63158c98a8a45a189c68ce4792c027615ac0c9f1c61cacee1e02e817cc
7
- data.tar.gz: dd1f06f1b17cbc005ca5399d86b62cfe420787d8a2f820d24f589f30dd58af99ed539eb5d5873f90b3877f986093a3bc5f176dcb7aaaeea176381809272b20ff
6
+ metadata.gz: 9c0ef8d9c2bbbc39eee0c63c591097431b8cd428f5f3cfa03fedc15158f22fc05b6efab56bbad5990f967f45400af07a9c205da1c5953873dff9dcdc6ac24237
7
+ data.tar.gz: 03bcde0becfa611a100cb43c5d7982bfd3d156a264e817b9c01b1f4522fff7379a4279f25fa9f92d64535d411c597894adb7ba4004cc923c721721899cc9b99a
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1.10
5
3
  - 2.2
6
4
  - 2.3
5
+ - 2.4
6
+ - 2.5
7
+ - 2.6
8
+ - 2.7
7
9
  - jruby
8
10
  - ruby-head
9
11
 
@@ -1,5 +1,11 @@
1
1
  = BinData Changelog
2
2
 
3
+ == Version 2.4.5 (2020-02-21)
4
+
5
+ * Small typo fixes to examples.
6
+ * Fix encoding issue for ruby 2.7. Thanks to Aaron Patterson.
7
+ * Quieter test output.
8
+
3
9
  == Version 2.4.4 (2018-10-03)
4
10
 
5
11
  * Display a hint when endian is omitted. Requested by Tails.
@@ -9,16 +9,14 @@ Gem::Specification.new do |s|
9
9
  s.author = 'Dion Mendel'
10
10
  s.email = 'bindata@dm9.info'
11
11
  s.homepage = 'http://github.com/dmendel/bindata'
12
- s.rubyforge_project = 'bindata'
13
12
  s.require_path = 'lib'
14
- s.has_rdoc = true
15
13
  s.extra_rdoc_files = ['NEWS.rdoc']
16
14
  s.rdoc_options << '--main' << 'NEWS.rdoc'
17
15
  s.files = `git ls-files`.split("\n")
18
16
  s.license = 'Ruby'
19
17
 
20
18
  s.add_development_dependency('rake')
21
- s.add_development_dependency('minitest', "> 5.0.0")
19
+ s.add_development_dependency('minitest', "> 5.0.0", "< 5.12.0")
22
20
  s.add_development_dependency('coveralls')
23
21
  s.description = <<-END.gsub(/^ +/, "")
24
22
  BinData is a declarative way to read and write binary file formats.
@@ -14,7 +14,7 @@ class MacAddr < BinData::Primitive
14
14
  array :octets, type: :uint8, initial_length: 6
15
15
 
16
16
  def set(val)
17
- self.octets = val.split(/\./).collect(&:to_i)
17
+ self.octets = val.split(/:/).collect(&:to_i)
18
18
  end
19
19
 
20
20
  def get
@@ -23,7 +23,7 @@ class MacAddr < BinData::Primitive
23
23
  end
24
24
 
25
25
  # Present IP addresses in a human readable way
26
- class IPAddr < BinData::Primitive
26
+ class IP_Addr < BinData::Primitive
27
27
  array :octets, type: :uint8, initial_length: 4
28
28
 
29
29
  def set(val)
@@ -172,8 +172,7 @@ module BinData
172
172
  def to_binary_s(&block)
173
173
  io = BinData::IO.create_string_io
174
174
  write(io, &block)
175
- io.rewind
176
- io.read
175
+ io.string
177
176
  end
178
177
 
179
178
  # Returns the hexadecimal string representation of this data object.
@@ -1,3 +1,3 @@
1
1
  module BinData
2
- VERSION = "2.4.4"
2
+ VERSION = "2.4.5"
3
3
  end
@@ -52,6 +52,25 @@ describe BinData::Buffer, "subclassed with a single type" do
52
52
  obj.to_binary_s.must_equal_binary "\000\003\000\000\000"
53
53
  end
54
54
 
55
+ it "returns binary encoded data" do
56
+ obj = IntBuffer.new(3)
57
+ obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
58
+ end
59
+
60
+ it "returns binary encoded data despite Encoding.default_internal" do
61
+ w, $-w = $-w, false
62
+ before_enc = Encoding.default_internal
63
+
64
+ begin
65
+ Encoding.default_internal = Encoding::UTF_8
66
+ obj = IntBuffer.new(3)
67
+ obj.to_binary_s.encoding.must_equal Encoding::ASCII_8BIT
68
+ ensure
69
+ Encoding.default_internal = before_enc
70
+ $-w = w
71
+ end
72
+ end
73
+
55
74
  it "has total num_bytes" do
56
75
  obj = IntBuffer.new
57
76
  assert obj.clear?
@@ -74,9 +74,15 @@ describe BinData::Base, "offsets" do
74
74
  end
75
75
 
76
76
  it "adjust offset when incorrect" do
77
- io.seek(2)
78
- obj = TenByteOffsetBase.create(adjust_offset: 13)
79
- obj.read(io).snapshot.must_equal data[2 + 13, 3]
77
+ w, $-w = $-w, false
78
+
79
+ begin
80
+ io.seek(2)
81
+ obj = TenByteOffsetBase.create(adjust_offset: 13)
82
+ obj.read(io).snapshot.must_equal data[2 + 13, 3]
83
+ ensure
84
+ $-w = w
85
+ end
80
86
  end
81
87
 
82
88
  it "succeeds when offset is correct" do
@@ -36,10 +36,16 @@ describe BinData::Registry do
36
36
  end
37
37
 
38
38
  it "allows overriding of registered classes" do
39
- r.register('A', A)
40
- r.register('A', B)
39
+ w, $-w = $-w, false
41
40
 
42
- r.lookup('a').must_equal B
41
+ begin
42
+ r.register('A', A)
43
+ r.register('A', B)
44
+
45
+ r.lookup('a').must_equal B
46
+ ensure
47
+ $-w = w
48
+ end
43
49
  end
44
50
 
45
51
  it "converts CamelCase to underscores" do
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.4
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dion Mendel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2020-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 5.0.0
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 5.12.0
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - ">"
39
42
  - !ruby/object:Gem::Version
40
43
  version: 5.0.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 5.12.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: coveralls
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -164,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
170
  - !ruby/object:Gem::Version
165
171
  version: '0'
166
172
  requirements: []
167
- rubyforge_project: bindata
168
- rubygems_version: 2.7.6
173
+ rubygems_version: 3.1.2
169
174
  signing_key:
170
175
  specification_version: 4
171
176
  summary: A declarative way to read and write binary file formats