Class: Origami::PPKLite::Parser

Inherits:
Origami::Parser show all
Defined in:
lib/origami/parsers/ppklite.rb

Constant Summary

Constants inherited from Origami::Parser

Origami::Parser::VERBOSE_DEBUG, Origami::Parser::VERBOSE_INFO, Origami::Parser::VERBOSE_QUIET, Origami::Parser::VERBOSE_TRACE

Instance Attribute Summary

Attributes inherited from Origami::Parser

#options

Instance Method Summary collapse

Methods inherited from Origami::Parser

#debug, #defer_type_cast, #error, #info, #initialize, #parse_object, #parse_trailer, #parse_xreftable, #pos, #pos=, #target_data, #target_filename, #target_filesize, #trace, #warn

Constructor Details

This class inherits a constructor from Origami::Parser

Instance Method Details

#parse(stream) ⇒ Object

:nodoc:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/origami/parsers/ppklite.rb', line 28

def parse(stream) #:nodoc:
    super

    address_book = PPKLite.new(self)
    address_book.header = PPKLite::Header.parse(@data)
    @options[:callback].call(address_book.header)

    loop do
        break if (object = parse_object).nil?
        address_book.insert(object)
    end

    address_book.revisions.first.xreftable = parse_xreftable
    address_book.revisions.first.trailer = parse_trailer

    if Origami::OPTIONS[:enable_type_propagation]
        trailer = address_book.revisions.first.trailer

        if trailer[:Root].is_a?(Reference)
            address_book.cast_object(trailer[:Root], PPKLite::Catalog)
        end

        propagate_types(address_book)
    end

    address_book
end