Class: PDF::Reader::LZW::StringTable
- Inherits:
-
Hash
- Object
- ObjectHash
- Hash
- PDF::Reader::LZW::StringTable
- Defined in:
- lib/pdf/reader/lzw.rb
Overview
stores de pairs code => string
Instance Attribute Summary collapse
-
#string_table_pos ⇒ Object
readonly
:nodoc:.
Attributes inherited from ObjectHash
#default, #pdf_version, #sec_handler, #trailer
Instance Method Summary collapse
-
#[](key) ⇒ Object
if code less than 258 return fixed string.
- #add(string) ⇒ Object
-
#initialize ⇒ StringTable
constructor
A new instance of StringTable.
Methods inherited from Hash
Methods inherited from ObjectHash
#deref!, #each, #each_key, #each_value, #empty?, #encrypted?, #fetch, #has_key?, #has_value?, #keys, #obj_type, #object, #page_references, #sec_handler?, #size, #stream?, #to_a, #to_s, #values, #values_at
Constructor Details
#initialize ⇒ StringTable
Returns a new instance of StringTable.
65 66 67 68 |
# File 'lib/pdf/reader/lzw.rb', line 65 def initialize super @string_table_pos = 258 #initial code end |
Instance Attribute Details
#string_table_pos ⇒ Object (readonly)
:nodoc:
63 64 65 |
# File 'lib/pdf/reader/lzw.rb', line 63 def string_table_pos @string_table_pos end |
Instance Method Details
#[](key) ⇒ Object
if code less than 258 return fixed string
71 72 73 |
# File 'lib/pdf/reader/lzw.rb', line 71 def [](key) if key > 257 then super else key.chr end end |
#add(string) ⇒ Object
75 76 77 78 |
# File 'lib/pdf/reader/lzw.rb', line 75 def add(string) store(@string_table_pos, string) @string_table_pos += 1 end |