class TTFunk::Table

Attributes

file[R]
length[R]
offset[R]

Public Class Methods

new(file) click to toggle source
# File lib/ttfunk/table.rb, line 12
def initialize(file)
  @file = file
  @offset = nil
  @length = nil

  info = file.directory_info(tag)

  if info
    @offset = info[:offset]
    @length = info[:length]

    parse_from(@offset) { parse! }
  end
end

Public Instance Methods

exists?() click to toggle source
# File lib/ttfunk/table.rb, line 27
def exists?
  !@offset.nil?
end
raw() click to toggle source
# File lib/ttfunk/table.rb, line 31
def raw
  if exists?
    parse_from(offset) { io.read(length) }
  end
end
tag() click to toggle source
# File lib/ttfunk/table.rb, line 37
def tag
  self.class.name.split(/::/).last.downcase
end

Private Instance Methods

parse!() click to toggle source
# File lib/ttfunk/table.rb, line 43
def parse!
  # do nothing, by default
end