Class: PDF::Reader::CMap
- Inherits:
-
Object
- Object
- PDF::Reader::CMap
- Defined in:
- lib/pdf/reader/cmap.rb
Overview
:nodoc:
Instance Attribute Summary (collapse)
-
- (Object) map
readonly
Returns the value of attribute map.
Instance Method Summary (collapse)
- - (Object) decode(c)
-
- (CMap) initialize(data)
constructor
A new instance of CMap.
- - (Object) process_data(data)
- - (Object) size
Constructor Details
- (CMap) initialize(data)
A new instance of CMap
31 32 33 34 |
# File 'lib/pdf/reader/cmap.rb', line 31 def initialize(data) @map = {} process_data(data) end |
Instance Attribute Details
- (Object) map (readonly)
Returns the value of attribute map
29 30 31 |
# File 'lib/pdf/reader/cmap.rb', line 29 def map @map end |
Instance Method Details
- (Object) decode(c)
63 64 65 66 67 |
# File 'lib/pdf/reader/cmap.rb', line 63 def decode(c) # TODO: implement the conversion return c unless c.class == Fixnum @map[c] end |
- (Object) process_data(data)
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pdf/reader/cmap.rb', line 36 def process_data(data) mode = nil instructions = "" data.each_line do |l| if l.include?("beginbfchar") mode = :char elsif l.include?("endbfchar") process_bfchar_instructions(instructions) instructions = "" mode = nil elsif l.include?("beginbfrange") mode = :range elsif l.include?("endbfrange") process_bfrange_instructions(instructions) instructions = "" mode = nil elsif mode == :char || mode == :range instructions << l end end end |
- (Object) size
59 60 61 |
# File 'lib/pdf/reader/cmap.rb', line 59 def size @map.size end |