bit-struct 0.13.3 → 0.13.4

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.
@@ -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
- == Version
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
 
@@ -9,7 +9,7 @@
9
9
  # The String#replace method is useful.
10
10
  #
11
11
  class BitStruct < String
12
- VERSION = "0.13.3"
12
+ VERSION = "0.13.4"
13
13
 
14
14
  class Field
15
15
  # Offset of field in bits.
@@ -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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bit-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel VanderWerf