Class: PdfEditor::TitlePage

Inherits:
Object
  • Object
show all
Includes:
Errors, PrawnDSL, Service
Defined in:
lib/pdf_editor/title_page.rb

Constant Summary

Constants included from Errors

Errors::ArgumentMissingError, Errors::InvalidInputError, Errors::InvalidPDFError, Errors::PageCountError, Errors::PageOrderInvalidError, Errors::PageRangeError, Errors::ResourcesEmptyError, Errors::TitlePageTitleError

Constants included from Service

Service::InterfaceNotImplementedError, Service::MustPassBlockToAsTempfile

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PrawnDSL

#document, #method_missing, #respond_to_missing?, #save_to_file, #to_pdf, #update_pdf

Methods included from Service

included, #initialize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PdfEditor::PrawnDSL

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



11
12
13
# File 'lib/pdf_editor/title_page.rb', line 11

def title
  @title
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
# File 'lib/pdf_editor/title_page.rb', line 17

def call
  unless title
    raise Errors::TitlePageTitleError, 'Title page requires a title to operate'
  end
  PdfEditor::Resource.new(
    create_tempfile {create_pdf}, 
    title
  )
end

#post_initObject



13
14
15
# File 'lib/pdf_editor/title_page.rb', line 13

def post_init
  @title = args[:title]
end