bindata 3.0.0 → 3.0.1
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 +4 -4
- data/ChangeLog.rdoc +4 -0
- data/NEWS.rdoc +8 -7
- data/bindata.gemspec +1 -1
- data/lib/bindata/base.rb +1 -1
- data/lib/bindata/base_primitive.rb +5 -5
- data/lib/bindata/buffer.rb +2 -2
- data/lib/bindata/choice.rb +2 -2
- data/lib/bindata/delayed_io.rb +2 -2
- data/lib/bindata/dsl.rb +4 -4
- data/lib/bindata/int.rb +9 -1
- data/lib/bindata/lazy.rb +9 -9
- data/lib/bindata/primitive.rb +2 -2
- data/lib/bindata/section.rb +2 -2
- data/lib/bindata/struct.rb +1 -1
- data/lib/bindata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b670424a13b7123595397994e787cd02b104b20f845b825711585415c96a1431
|
|
4
|
+
data.tar.gz: cd5c8045b0e11b0e1a4aedac7187431ca3e3b496b15da69a39aa8cfb30b0ae60
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce3c150c5a502320e0a8240478d87a923b3e70b48ff1861d4fdd1ef2508a6fc54c6c1f4f3bbd401efc6cf5ad948591141c14c8ad3b8326af118c3b86ad8b192f
|
|
7
|
+
data.tar.gz: a1f12321b82972f9adf2afda0363b8b2d4be504f24b02855015bf9d49e072b4031112bb1149145a4d02e663207bf4e2c62d6b7cf6c199ee54e7b11e56e0af350
|
data/ChangeLog.rdoc
CHANGED
data/NEWS.rdoc
CHANGED
|
@@ -11,25 +11,26 @@ method.
|
|
|
11
11
|
== 2.5.x
|
|
12
12
|
|
|
13
13
|
class Ns1Foo << BinData::Record; end
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
class Ns2Foo << BinData::Record; end
|
|
16
|
+
class Ns2Bar << BinData::Record; end
|
|
16
17
|
|
|
17
18
|
class MyClass < BinData::Record
|
|
18
19
|
search_prefix ns2
|
|
19
|
-
foo
|
|
20
|
-
bar
|
|
21
|
-
ns1_foo :c
|
|
20
|
+
foo :a # resolves to ns2_foo
|
|
21
|
+
bar :b # resolves to ns2_bar
|
|
22
|
+
ns1_foo :c # explicitly ns1_foo
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
== 3.0.0
|
|
25
26
|
|
|
26
27
|
module Ns1
|
|
27
28
|
class Foo << BinData::Record; end
|
|
28
|
-
class Bar << BinData::Record; end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
module Ns2
|
|
32
32
|
class Foo << BinData::Record; end
|
|
33
|
+
class Bar << BinData::Record; end
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
module Ns2
|
|
@@ -44,8 +45,8 @@ method.
|
|
|
44
45
|
|
|
45
46
|
class MyClass < BinData::Record
|
|
46
47
|
search_namespace :ns2
|
|
47
|
-
foo
|
|
48
|
-
bar
|
|
48
|
+
foo :a
|
|
49
|
+
bar :b
|
|
49
50
|
ns1_foo :c
|
|
50
51
|
end
|
|
51
52
|
|
data/bindata.gemspec
CHANGED
data/lib/bindata/base.rb
CHANGED
|
@@ -57,7 +57,7 @@ module BinData
|
|
|
57
57
|
define_singleton_method(:inherited) do |subclass|
|
|
58
58
|
m = /(.*)::([^:].*)/.match(subclass.name)
|
|
59
59
|
namespace = m ? m[1] : ""
|
|
60
|
-
shortname = m ? m[2] : subclass
|
|
60
|
+
shortname = m ? m[2] : subclass.name
|
|
61
61
|
RegisteredClasses.register(namespace, shortname, subclass)
|
|
62
62
|
register_subclasses
|
|
63
63
|
end
|
|
@@ -93,15 +93,15 @@ module BinData
|
|
|
93
93
|
child.respond_to?(symbol, include_all) || super
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
def method_missing(symbol,
|
|
96
|
+
def method_missing(symbol, ...) # :nodoc:
|
|
97
97
|
child = snapshot
|
|
98
98
|
if child.respond_to?(symbol)
|
|
99
99
|
self.class.class_eval <<-END, __FILE__, __LINE__ + 1
|
|
100
|
-
def #{symbol}(
|
|
101
|
-
snapshot.#{symbol}(
|
|
102
|
-
end
|
|
100
|
+
def #{symbol}(...) # def clamp(...)
|
|
101
|
+
snapshot.#{symbol}(...) # snapshot.clamp(...)
|
|
102
|
+
end # end
|
|
103
103
|
END
|
|
104
|
-
child.__send__(symbol,
|
|
104
|
+
child.__send__(symbol, ...)
|
|
105
105
|
else
|
|
106
106
|
super
|
|
107
107
|
end
|
data/lib/bindata/buffer.rb
CHANGED
|
@@ -84,8 +84,8 @@ module BinData
|
|
|
84
84
|
@type.respond_to?(symbol, include_all) || super
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def method_missing(
|
|
88
|
-
@type.__send__(
|
|
87
|
+
def method_missing(...) # :nodoc:
|
|
88
|
+
@type.__send__(...)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def do_read(io) # :nodoc:
|
data/lib/bindata/choice.rb
CHANGED
|
@@ -90,8 +90,8 @@ module BinData
|
|
|
90
90
|
current_choice.respond_to?(symbol, include_all) || super
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
def method_missing(
|
|
94
|
-
current_choice.__send__(
|
|
93
|
+
def method_missing(...) # :nodoc:
|
|
94
|
+
current_choice.__send__(...)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
%w[clear? assign snapshot do_read do_write do_num_bytes].each do |m|
|
data/lib/bindata/delayed_io.rb
CHANGED
|
@@ -87,8 +87,8 @@ module BinData
|
|
|
87
87
|
@type.respond_to?(symbol, include_all) || super
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
def method_missing(
|
|
91
|
-
@type.__send__(
|
|
90
|
+
def method_missing(...) # :nodoc:
|
|
91
|
+
@type.__send__(...)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def abs_offset
|
data/lib/bindata/dsl.rb
CHANGED
|
@@ -42,8 +42,8 @@ module BinData
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def method_missing(
|
|
46
|
-
dsl_parser.__send__(
|
|
45
|
+
def method_missing(...) # :nodoc:
|
|
46
|
+
dsl_parser.__send__(...)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# Assert object is not an array or string.
|
|
@@ -134,9 +134,9 @@ module BinData
|
|
|
134
134
|
send(abilities.at(0), abilities.at(1))
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
def method_missing(
|
|
137
|
+
def method_missing(...)
|
|
138
138
|
ensure_hints
|
|
139
|
-
parse_and_append_field(
|
|
139
|
+
parse_and_append_field(...)
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
#-------------
|
data/lib/bindata/int.rb
CHANGED
|
@@ -72,9 +72,17 @@ module BinData
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def create_raw_read_code(nbits, endian, signed)
|
|
75
|
-
|
|
75
|
+
nwords = nbits / bits_per_word(nbits)
|
|
76
|
+
|
|
76
77
|
if nbits == 8
|
|
78
|
+
# faster code for 8bit integers
|
|
77
79
|
"io.readbytes(1).ord"
|
|
80
|
+
elsif nwords == 1
|
|
81
|
+
# avoid transient arrays for 16, 32 and 64 bit integers
|
|
82
|
+
nbytes = nbits / 8
|
|
83
|
+
pack_directive = pack_directive(nbits, endian, signed)
|
|
84
|
+
|
|
85
|
+
"io.readbytes(#{nbytes}).unpack1('#{pack_directive}')"
|
|
78
86
|
else
|
|
79
87
|
unpack_str = create_read_unpack_code(nbits, endian, signed)
|
|
80
88
|
assemble_str = create_read_assemble_code(nbits, endian)
|
data/lib/bindata/lazy.rb
CHANGED
|
@@ -62,11 +62,11 @@ module BinData
|
|
|
62
62
|
raise NoMethodError, "no index found"
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def method_missing(symbol,
|
|
65
|
+
def method_missing(symbol, ...)
|
|
66
66
|
return @overrides[symbol] if defined?(@overrides) && @overrides.key?(symbol)
|
|
67
67
|
|
|
68
68
|
if @obj.parent
|
|
69
|
-
eval_symbol_in_parent_context(symbol,
|
|
69
|
+
eval_symbol_in_parent_context(symbol, ...)
|
|
70
70
|
else
|
|
71
71
|
super
|
|
72
72
|
end
|
|
@@ -75,26 +75,26 @@ module BinData
|
|
|
75
75
|
#---------------
|
|
76
76
|
private
|
|
77
77
|
|
|
78
|
-
def eval_symbol_in_parent_context(symbol,
|
|
79
|
-
result = resolve_symbol_in_parent_context(symbol,
|
|
80
|
-
recursively_eval(result,
|
|
78
|
+
def eval_symbol_in_parent_context(symbol, ...)
|
|
79
|
+
result = resolve_symbol_in_parent_context(symbol, ...)
|
|
80
|
+
recursively_eval(result, ...)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
def resolve_symbol_in_parent_context(symbol,
|
|
83
|
+
def resolve_symbol_in_parent_context(symbol, ...)
|
|
84
84
|
obj_parent = @obj.parent
|
|
85
85
|
|
|
86
86
|
if obj_parent.has_parameter?(symbol)
|
|
87
87
|
obj_parent.get_parameter(symbol)
|
|
88
88
|
elsif obj_parent.safe_respond_to?(symbol, true)
|
|
89
|
-
obj_parent.__send__(symbol,
|
|
89
|
+
obj_parent.__send__(symbol, ...)
|
|
90
90
|
else
|
|
91
91
|
symbol
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
def recursively_eval(val,
|
|
95
|
+
def recursively_eval(val, ...)
|
|
96
96
|
if val.is_a?(Symbol)
|
|
97
|
-
parent.__send__(val,
|
|
97
|
+
parent.__send__(val, ...)
|
|
98
98
|
elsif callable?(val)
|
|
99
99
|
parent.instance_exec(&val)
|
|
100
100
|
else
|
data/lib/bindata/primitive.rb
CHANGED
|
@@ -77,9 +77,9 @@ module BinData
|
|
|
77
77
|
@struct.respond_to?(symbol, include_private) || super
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
def method_missing(symbol,
|
|
80
|
+
def method_missing(symbol, ...) # :nodoc:
|
|
81
81
|
if @struct.respond_to?(symbol)
|
|
82
|
-
@struct.__send__(symbol,
|
|
82
|
+
@struct.__send__(symbol, ...)
|
|
83
83
|
else
|
|
84
84
|
super
|
|
85
85
|
end
|
data/lib/bindata/section.rb
CHANGED
|
@@ -65,8 +65,8 @@ module BinData
|
|
|
65
65
|
@type.respond_to?(symbol, include_all) || super
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def method_missing(
|
|
69
|
-
@type.__send__(
|
|
68
|
+
def method_missing(...) # :nodoc:
|
|
69
|
+
@type.__send__(...)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def do_read(io) # :nodoc:
|
data/lib/bindata/struct.rb
CHANGED
data/lib/bindata/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bindata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dion Mendel
|
|
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
159
159
|
requirements:
|
|
160
160
|
- - ">="
|
|
161
161
|
- !ruby/object:Gem::Version
|
|
162
|
-
version:
|
|
162
|
+
version: 3.0.0
|
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements:
|
|
165
165
|
- - ">="
|