class PDF::Reader::LZW::StringTable

stores de pairs code => string

Attributes

string_table_pos[R]

: Integer

Public Class Methods

new() click to toggle source

: () -> void

# File lib/pdf/reader/lzw.rb, line 75
def initialize
  @data = Hash.new #: Hash[Integer, String]
  # The initial code
  @string_table_pos = 258 #: Integer
end

Public Instance Methods

[](key) click to toggle source

if code less than 258 return fixed string : (Integer) -> String?

# File lib/pdf/reader/lzw.rb, line 83
def [](key)
  if key > 257
    @data[key]
  else
    key.chr
  end
end
add(string) click to toggle source

: (String) -> void

# File lib/pdf/reader/lzw.rb, line 92
def add(string)
  @data.store(@string_table_pos, string)
  @string_table_pos += 1
end