Method: BitStruct::Vector.default_options

Defined in:
lib/bit-struct/vector.rb

.default_options(h = nil) ⇒ Object

Get or set the hash of default options for the class, which apply to all fields in the entries. If h is provided, update the default options with that hash. Default options are inherited.

This is especially useful with the :endian => val option.



63
64
65
66
67
68
69
70
71
72
# File 'lib/bit-struct/vector.rb', line 63

def default_options h = nil
  @default_options ||= superclass.default_options.dup
  if h
    @default_options.merge! h
    if @struct_class
      @struct_class.default_options h
    end
  end
  @default_options
end