bit-struct 0.13.3 → 0.13.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -2
- data/README.txt +1 -3
- data/lib/bit-struct/bit-struct.rb +1 -1
- data/lib/bit-struct/fields.rb +3 -1
- metadata +1 -1
data/History.txt
CHANGED
@@ -2,9 +2,9 @@ bit-struct 0.13
|
|
2
2
|
|
3
3
|
- Packaged as a gem using bones.
|
4
4
|
|
5
|
-
- Added nest fields defined with blocks.
|
5
|
+
- Added nest fields defined with blocks. (Markus Fischer)
|
6
6
|
|
7
|
-
- Vector length may be specified as argument or :length option.
|
7
|
+
- Vector length may be specified as argument or :length option. (Markus Fischer)
|
8
8
|
|
9
9
|
bit-struct 0.12
|
10
10
|
|
data/README.txt
CHANGED
@@ -173,9 +173,7 @@ The output of this fragment is:
|
|
173
173
|
@16: octets ip_dst [ 32b] Dest addr
|
174
174
|
rest is application defined message body
|
175
175
|
|
176
|
-
==
|
177
|
-
|
178
|
-
bit-struct 0.12
|
176
|
+
== Web site
|
179
177
|
|
180
178
|
The current version of this software can be found at http://redshift.sourceforge.net/bit-struct.
|
181
179
|
|
data/lib/bit-struct/fields.rb
CHANGED
@@ -96,8 +96,10 @@ class BitStruct
|
|
96
96
|
# p a # ==> #<A n=#<Sub x=3>>
|
97
97
|
#
|
98
98
|
def nest(name, *rest, &block)
|
99
|
+
nested_class = rest.grep(Class).find {|cl| cl <= BitStruct}
|
100
|
+
rest.delete nested_class
|
99
101
|
opts = parse_options(rest, name, NestedField)
|
100
|
-
nested_class = opts[:nested_class]
|
102
|
+
nested_class = opts[:nested_class] ||= nested_class
|
101
103
|
|
102
104
|
unless (block and not nested_class) or (nested_class and not block)
|
103
105
|
raise ArgumentError,
|