Method: PDF::Reader::Encoding#initialize
- Defined in:
- lib/pdf/reader/encoding.rb
#initialize(enc) ⇒ Encoding
Returns a new instance of Encoding.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/pdf/reader/encoding.rb', line 38 def initialize(enc) @mapping = default_mapping # maps from character codes to Unicode codepoints @string_cache = {} # maps from character codes to UTF-8 strings. if enc.kind_of?(Hash) self.differences = enc[:Differences] if enc[:Differences] enc = enc[:Encoding] || enc[:BaseEncoding] elsif enc != nil enc = enc.to_sym else enc = nil end @enc_name = enc @unpack = get_unpack(enc) @map_file = get_mapping_file(enc) load_mapping(@map_file) if @map_file end |