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 11
def initialize(file)
  @file = file

  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 24
def exists?
  !@offset.nil?
end
raw() click to toggle source
# File lib/ttfunk/table.rb, line 28
def raw
  if exists?
    parse_from(offset) { io.read(length) }
  end
end
tag() click to toggle source
# File lib/ttfunk/table.rb, line 34
def tag
  self.class.name.split(/::/).last.downcase
end

Private Instance Methods

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