Class: Prune::Parsers::PageParser

Inherits:
Base
  • Object
show all
Defined in:
lib/prune/parsers/document/page_parser.rb

Overview

Parser for directive “page”.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Prune::PObjects

pa, pd, ph, pl, pn, ps

Methods included from Functions

#mm_to_pt, #pt_to_mm

Constructor Details

#initialize(document, size, options = {}) ⇒ PageParser

Initialize.

Raises:

  • (DocumenteSizeError)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/prune/parsers/document/page_parser.rb', line 10

def initialize(document, size, options = {})
  @document = document
  # Check document size.
  raise DocumenteSizeError unless DOCUMENT_SIZES.has_key?(size)
  document_size = DOCUMENT_SIZES[size]
  # Create a new page.
  width, height = document_size.collect{|mm| mm_to_pt(mm)}
  @page = Page.new(@document, [0.0, 0.0, width, height], options)
  # Add page to pages.
  @document.pages << @page
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



7
8
9
# File 'lib/prune/parsers/document/page_parser.rb', line 7

def page
  @page
end