Class: BinData::Skip

Inherits:
BasePrimitive show all
Defined in:
lib/bindata/skip.rb

Overview

Skip will skip over bytes from the input stream. If the stream is not seekable, then the bytes are consumed and discarded.

When writing, skip will write :length number of zero bytes.

require 'bindata'

class A < BinData::Record
  skip :length => 5
  string :a, :read_length => 5
end

obj = A.read("abcdefghij")
obj.a #=> "fghij"

Parameters

Skip objects accept all the params that BinData::BasePrimitive does, as well as the following:

:length

The number of bytes to skip.

Instance Attribute Summary

Attributes inherited from Base

#parent

Method Summary

Methods inherited from BasePrimitive

#clear, #clear?, #eql?, #hash, #initialize, #method_missing, #respond_to?, #value, #value=

Methods inherited from Base

#==, accepted_parameters, #assign, #clear, #clear?, #debug_name, #debug_name_of, default_parameters, #eval_parameter, #get_parameter, #has_parameter?, #initialize, #inspect, mandatory_parameters, mutually_exclusive_parameters, #num_bytes, #offset, #offset_of, optional_parameters, #pretty_print, #read, read, #rel_offset, sanitize_parameters!, #snapshot, #to_binary_s, #to_s, #write

Constructor Details

This class inherits a constructor from BinData::BasePrimitive

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BinData::BasePrimitive