Class: Prawn::DocumentBuilder::Command
- Inherits:
-
Object
- Object
- Prawn::DocumentBuilder::Command
- Defined in:
- lib/prawn/document_builder/command.rb
Direct Known Subclasses
FlowingTextConstruct, LayoutModification, PathConstruct, PathModification
Instance Attribute Summary collapse
-
#box ⇒ Object
Returns the value of attribute box.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #execute(document, layout) ⇒ Object
-
#initialize(name, params = {}) ⇒ Command
constructor
A new instance of Command.
- #restore_params ⇒ Object
- #save_params ⇒ Object
- #setup ⇒ Object
- #teardown ⇒ Object
Constructor Details
#initialize(name, params = {}) ⇒ Command
Returns a new instance of Command.
4 5 6 7 |
# File 'lib/prawn/document_builder/command.rb', line 4 def initialize(name, params={}) @name = name @params = params end |
Instance Attribute Details
#box ⇒ Object
Returns the value of attribute box.
11 12 13 |
# File 'lib/prawn/document_builder/command.rb', line 11 def box @box end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/prawn/document_builder/command.rb', line 9 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
10 11 12 |
# File 'lib/prawn/document_builder/command.rb', line 10 def params @params end |
Instance Method Details
#execute(document, layout) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/prawn/document_builder/command.rb', line 17 def execute(document, layout) save_params setup send(name, document, layout) teardown restore_params end |
#restore_params ⇒ Object
33 34 35 |
# File 'lib/prawn/document_builder/command.rb', line 33 def restore_params @params = @original_params end |
#save_params ⇒ Object
29 30 31 |
# File 'lib/prawn/document_builder/command.rb', line 29 def save_params @original_params = @params.dup end |
#setup ⇒ Object
13 14 15 |
# File 'lib/prawn/document_builder/command.rb', line 13 def setup # stub, replace in your subclasses end |
#teardown ⇒ Object
25 26 27 |
# File 'lib/prawn/document_builder/command.rb', line 25 def teardown # stub, replace in your subclasses end |