Class: Origami::FDF::Parser

Inherits:
Parser
  • Object
show all
Defined in:
lib/origami/parsers/fdf.rb

Constant Summary

Constants inherited from Parser

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

Instance Attribute Summary

Attributes inherited from Parser

#options

Instance Method Summary collapse

Methods inherited from Parser

#debug, #defer_type_cast, #error, #info, init_scanner, #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:



26
27
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
# File 'lib/origami/parsers/fdf.rb', line 26

def parse(stream) # :nodoc:
  super

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

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

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

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

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

    propagate_types(fdf)
  end

  fdf
end