Module: RGhost::DocumentCallbackFacade
- Included in:
- Document
- Defined in:
- lib/rghost/document_callback_facade.rb
Overview
This module is included inside of Document class. It will creates methods to easy the use.
Callback execution order
Example for a document with 4 pages, looking at the picture you can see the order in which the callbacks are executed
Instance Method Summary collapse
-
#after_page_create(options = {}, &block) ⇒ Object
Executes after page create.
-
#after_virtual_page_create(options = {}, &block) ⇒ Object
Executes after virtual page create.
-
#before_document_create(&block) ⇒ Object
Executes one time before document create.
-
#before_page_create(options = {}, &block) ⇒ Object
Executes before page create.
-
#before_virtual_page_create(options = {}, &block) ⇒ Object
Executes before virtual page create.
-
#even_pages(options = {}, &block) ⇒ Object
Executes on even pages create.
-
#first_page(&block) ⇒ Object
Executes one time on first page.
-
#last_page(&block) ⇒ Object
Executes one time on last page(end of document).
-
#odd_pages(options = {}, &block) ⇒ Object
Executes on odd pages create.
Instance Method Details
#after_page_create(options = {}, &block) ⇒ Object
Executes after page create. Respond to :only and :except options
15 16 17 |
# File 'lib/rghost/document_callback_facade.rb', line 15 def after_page_create(={},&block) new_dynamic_callback(:after_page_create,,&block) end |
#after_virtual_page_create(options = {}, &block) ⇒ Object
Executes after virtual page create. Respond to :only and :except options
48 49 50 |
# File 'lib/rghost/document_callback_facade.rb', line 48 def after_virtual_page_create(={},&block) new_dynamic_callback(:after_virtual_page_create,,&block) end |
#before_document_create(&block) ⇒ Object
Executes one time before document create.
30 31 32 |
# File 'lib/rghost/document_callback_facade.rb', line 30 def before_document_create(&block) new_static_callback(:before_document_create,&block) end |
#before_page_create(options = {}, &block) ⇒ Object
Executes before page create. Respond to :only and :except options
10 11 12 |
# File 'lib/rghost/document_callback_facade.rb', line 10 def before_page_create(={},&block) new_dynamic_callback(:before_page_create,,&block) end |
#before_virtual_page_create(options = {}, &block) ⇒ Object
Executes before virtual page create. Respond to :only and :except options
44 45 46 |
# File 'lib/rghost/document_callback_facade.rb', line 44 def before_virtual_page_create(={},&block) new_dynamic_callback(:before_virtual_page_create,,&block) end |
#even_pages(options = {}, &block) ⇒ Object
Executes on even pages create. Respond to :only and :except options
25 26 27 |
# File 'lib/rghost/document_callback_facade.rb', line 25 def even_pages(={},&block) new_dynamic_callback(:even_pages,,&block) end |
#first_page(&block) ⇒ Object
Executes one time on first page.
35 36 37 |
# File 'lib/rghost/document_callback_facade.rb', line 35 def first_page(&block) new_static_callback(:first_page,&block) end |
#last_page(&block) ⇒ Object
Executes one time on last page(end of document).
39 40 41 |
# File 'lib/rghost/document_callback_facade.rb', line 39 def last_page(&block) new_static_callback(:last_page,&block) end |
#odd_pages(options = {}, &block) ⇒ Object
Executes on odd pages create. Respond to :only and :except options
20 21 22 |
# File 'lib/rghost/document_callback_facade.rb', line 20 def odd_pages(={},&block) new_dynamic_callback(:odd_pages,,&block) end |