Class: PDF::Reader::LZW::StringTable
- Inherits:
- 
      Object
      
        - Object
- 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
    
    
  
  
  
  
  
  
    Returns the value of attribute string_table_pos. 
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. 
Constructor Details
#initialize ⇒ StringTable
Returns a new instance of StringTable.
| 69 70 71 72 | # File 'lib/pdf/reader/lzw.rb', line 69 def initialize @data = Hash.new @string_table_pos = 258 #initial code end | 
Instance Attribute Details
#string_table_pos ⇒ Object (readonly)
Returns the value of attribute string_table_pos.
| 67 68 69 | # File 'lib/pdf/reader/lzw.rb', line 67 def string_table_pos @string_table_pos end | 
Instance Method Details
#[](key) ⇒ Object
if code less than 258 return fixed string
| 75 76 77 78 79 80 81 | # File 'lib/pdf/reader/lzw.rb', line 75 def [](key) if key > 257 @data[key] else key.chr end end | 
#add(string) ⇒ Object
| 83 84 85 86 | # File 'lib/pdf/reader/lzw.rb', line 83 def add(string) @data.store(@string_table_pos, string) @string_table_pos += 1 end |