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.



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

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



114
115
116
117
# File 'lib/zippo/binary_structure/base.rb', line 114

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

#defaultObject



106
107
108
# File 'lib/zippo/binary_structure/base.rb', line 106

def default
  new.defaults
end