class BitStruct::NestedField
Class for nesting a BitStruct as a field within another BitStruct. Declared with BitStruct.nest.
Public Class Methods
class_name()
click to toggle source
Used in describe.
# File lib/bit-struct/nested-field.rb, line 12 def self.class_name @class_name ||= "nest" end
new(*args)
click to toggle source
Calls superclass method
BitStruct::Field.new
# File lib/bit-struct/nested-field.rb, line 7 def initialize(*args) super end
Public Instance Methods
class_name()
click to toggle source
# File lib/bit-struct/nested-field.rb, line 16 def class_name @class_name ||= nested_class.name[/\w+$/] end
describe(opts) { |desc| ... }
click to toggle source
Calls superclass method
BitStruct::Field#describe
# File lib/bit-struct/nested-field.rb, line 24 def describe opts if opts[:expand] opts = opts.dup opts[:byte_offset] = offset / 8 opts[:omit_header] = opts[:omit_footer] = true nested_class.describe(nil, opts) {|desc| yield desc} else super end end
nested_class()
click to toggle source
# File lib/bit-struct/nested-field.rb, line 20 def nested_class @nested_class ||= options[:nested_class] || options["nested_class"] end