Class: FormatParser::DPXParser::Binstr::Capture

Inherits:
Struct
  • Object
show all
Includes:
IOUtils
Defined in:
lib/parsers/dpx_parser/dpx_structs.rb

Constant Summary

Constants included from IOUtils

IOUtils::INTEGER_DIRECTIVES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IOUtils

#read_bytes, #read_fixed_point, #read_int, #safe_read, #safe_skip, #skip_bytes

Instance Attribute Details

#bytesObject

Returns the value of attribute bytes

Returns:

  • (Object)

    the current value of bytes



9
10
11
# File 'lib/parsers/dpx_parser/dpx_structs.rb', line 9

def bytes
  @bytes
end

#patternObject

Returns the value of attribute pattern

Returns:

  • (Object)

    the current value of pattern



9
10
11
# File 'lib/parsers/dpx_parser/dpx_structs.rb', line 9

def pattern
  @pattern
end

Instance Method Details

#read_and_unpack(io) ⇒ Object



11
12
13
14
# File 'lib/parsers/dpx_parser/dpx_structs.rb', line 11

def read_and_unpack(io)
  platform_byte_order_pattern = io.le? ? TO_LITTLE_ENDIAN.fetch(pattern, pattern) : pattern
  safe_read(io, bytes).unpack(platform_byte_order_pattern).first
end