Class: PdfTempura::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf_tempura/document.rb

Defined Under Namespace

Modules: DefaultCommands, Field, Validation Classes: BoxedCharacters, CharacterField, CheckboxField, FieldSet, Page, Table, TextField

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Document

Returns a new instance of Document.



44
45
46
# File 'lib/pdf_tempura/document.rb', line 44

def initialize(data = {})
  load_data(data)
end

Class Method Details

.debug(*options) ⇒ Object



38
39
40
# File 'lib/pdf_tempura/document.rb', line 38

def debug(*options)
  debug_options.concat options
end

.debug_optionsObject



34
35
36
# File 'lib/pdf_tempura/document.rb', line 34

def debug_options
  @debug_options ||= []
end

.page(page_number, &block) ⇒ Object



27
28
29
30
31
32
# File 'lib/pdf_tempura/document.rb', line 27

def page(page_number, &block)
  page = Page.new(page_number)
  pages << page
  page.instance_eval(&block)
  nil
end

.pagesObject



15
16
17
# File 'lib/pdf_tempura/document.rb', line 15

def pages
  @pages ||= []
end

.repeatableObject



19
20
21
# File 'lib/pdf_tempura/document.rb', line 19

def repeatable
  @repeatable = true
end

.repeatable_optionObject



23
24
25
# File 'lib/pdf_tempura/document.rb', line 23

def repeatable_option
  @repeatable || false
end

.template(path) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/pdf_tempura/document.rb', line 10

def template(path)
  raise ArgumentError, "Template path must be a string." unless path.is_a?(String)
  @template_file_path = path
end

.template_file_pathObject



6
7
8
# File 'lib/pdf_tempura/document.rb', line 6

def template_file_path
  @template_file_path
end

Instance Method Details

#pagesObject



48
49
50
# File 'lib/pdf_tempura/document.rb', line 48

def pages
  @pages ||= []
end

#render(&block) ⇒ Object



52
53
54
# File 'lib/pdf_tempura/document.rb', line 52

def render(&block)
  new_renderer.render(&block)
end