Class: Depix::Binary::Fields::Filler

Inherits:
Field
  • Object
show all
Defined in:
lib/depix/binary/fields.rb

Overview

Zero-padded filler, can be used to maintain offsets

Instance Attribute Summary

Attributes inherited from Field

#desc, #length, #name, #req, #rtype

Instance Method Summary collapse

Methods inherited from Field

#clean, #consume!, #explain, #initialize, #validate!

Constructor Details

This class inherits a constructor from Depix::Binary::Fields::Field

Instance Method Details

#consume(stack) ⇒ Object

Leave the stack alone since we skipped



125
126
127
# File 'lib/depix/binary/fields.rb', line 125

def consume(stack)
  nil
end

#pack(data) ⇒ Object



129
130
131
# File 'lib/depix/binary/fields.rb', line 129

def pack(data)
  raise "This is a filler, it cannot be reconstructed from a value"
end

#patternObject



120
121
122
# File 'lib/depix/binary/fields.rb', line 120

def pattern
  "x#{length ? length.to_i : 1}"
end