Module: Zippo::BinaryStructure::Base::ClassMethods

Defined in:
lib/zippo/binary_structure/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#structureObject (readonly)

Returns the value of attribute structure.



103
104
105
# File 'lib/zippo/binary_structure/base.rb', line 103

def structure
  @structure
end

Instance Method Details

#common_fields_with(other) ⇒ Object

Returns the fields that this data type has in common with other.

  • common fields are fields with the same name

  • signature fields are never common



112
113
114
115
# File 'lib/zippo/binary_structure/base.rb', line 112

def common_fields_with(other)
  structure.fields.map(&:name) &
    other.structure.fields.reject(&:signature?).map(&:name)
end

#defaultObject



104
105
106
# File 'lib/zippo/binary_structure/base.rb', line 104

def default
  new.defaults
end