Module: PdfEditor::PrawnDSL

Included in:
TableOfContents, TitlePage
Defined in:
lib/pdf_editor/mixins/prawn_dsl.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &b) ⇒ Object



26
27
28
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 26

def method_missing(method, *args, &b)
  document.send(method, *args, &b)
end

Instance Method Details

#documentObject



6
7
8
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 6

def document
  @document ||= Prawn::Document.new
end

#respond_to_missing?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 22

def respond_to_missing?(method_sym, include_private=false)
  document.respond_to_missing?(method_sym, include_private) || super
end

#save_to_file(file_name) ⇒ Object



18
19
20
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 18

def save_to_file(file_name)
  document.render_file(file_name)
end

#to_pdfObject



14
15
16
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 14

def to_pdf
  document.render
end

#update_pdf(&b) ⇒ Object



10
11
12
# File 'lib/pdf_editor/mixins/prawn_dsl.rb', line 10

def update_pdf(&b)
  instance_eval(&b)
end