Class: Fontisan::Binary::BaseRecord

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/fontisan/binary/base_record.rb

Overview

Base class for all BinData record definitions

Provides common configuration for OpenType binary structures:

  • Big-endian byte order (OpenType standard)

  • Common helper methods

All table parsers and binary structures should inherit from this class to ensure consistent behavior across the codebase.

Examples:

Defining a simple structure

class MyTable < Binary::BaseRecord
  uint16 :version
  uint16 :count
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.read(io) ⇒ Object

Override read to handle nil data gracefully



25
26
27
28
29
# File 'lib/fontisan/binary/base_record.rb', line 25

def self.read(io)
  return new if io.nil? || (io.respond_to?(:empty?) && io.empty?)

  super
end

Instance Method Details

#valid?Boolean

Check if the record is valid

Returns:

  • (Boolean)

    True if valid, false otherwise



34
35
36
# File 'lib/fontisan/binary/base_record.rb', line 34

def valid?
  true
end