Class: PageTemplate::Command
- Inherits:
-
Object
- Object
- PageTemplate::Command
- Defined in:
- lib/PageTemplate/commands.rb
Overview
Command classes generate text output based on conditions which vary between each class. Command provides an abstract base class to show interface.
Direct Known Subclasses
BlockCommand, CommentCommand, DefineCommand, IncludeCommand, StackableCommand, TextCommand, UnknownCommand, ValueCommand
Class Attribute Summary collapse
-
.closer ⇒ Object
readonly
Returns the value of attribute closer.
-
.modifier ⇒ Object
readonly
Returns the value of attribute modifier.
Instance Attribute Summary collapse
-
#called_as ⇒ Object
readonly
Returns the value of attribute called_as.
Instance Method Summary collapse
-
#output(namespace = nil) ⇒ Object
Subclasses of Command use the output method to generate their text output.
-
#to_s ⇒ Object
to_s of a Command prints out class and command information, for debugging and visual summary of the template without parsing the outputs.
Class Attribute Details
.closer ⇒ Object (readonly)
Returns the value of attribute closer.
18 19 20 |
# File 'lib/PageTemplate/commands.rb', line 18 def closer @closer end |
.modifier ⇒ Object (readonly)
Returns the value of attribute modifier.
18 19 20 |
# File 'lib/PageTemplate/commands.rb', line 18 def modifier @modifier end |
Instance Attribute Details
#called_as ⇒ Object (readonly)
Returns the value of attribute called_as.
16 17 18 |
# File 'lib/PageTemplate/commands.rb', line 16 def called_as @called_as end |
Instance Method Details
#output(namespace = nil) ⇒ Object
Subclasses of Command use the output method to generate their text output. namespace
is a Namespace object, which may be required by a particular subclass.
Command#output must return a string
26 27 28 29 |
# File 'lib/PageTemplate/commands.rb', line 26 def output(namespace = nil) raise NotImplementedError, "output() must be implemented by subclasses" end |
#to_s ⇒ Object
to_s of a Command prints out class and command information, for debugging and visual summary of the template without parsing the outputs.
34 35 36 |
# File 'lib/PageTemplate/commands.rb', line 34 def to_s "[ #{self.class} ]" end |