Class: PageTemplate::StackableCommand
- Defined in:
- lib/PageTemplate/commands.rb
Overview
StackableCommand is the parent class of any command that creates a branch in the logic: such as If, Loop, etcetera.
Any child that wants to do more than stand alone must inherit from StackableCommand. We recommend setting @called_as, so all of StackableCommand’s ways of closing blocks work.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
- #add(block) ⇒ Object
- #end ⇒ Object
-
#initialize(called_as = nil) ⇒ StackableCommand
constructor
allows a number of [% end %], [% end name %], [% endname %] or even [% /name %] to close StackableCommands.
- #to_s ⇒ Object
Methods inherited from Command
Constructor Details
#initialize(called_as = nil) ⇒ StackableCommand
allows a number of [% end %], [% end name %], [% endname %] or even [% /name %] to close StackableCommands.
99 100 101 |
# File 'lib/PageTemplate/commands.rb', line 99 def initialize(called_as=nil) raise ArgumentError, 'StackableCommand should not be called directly' end |
Instance Method Details
#add(block) ⇒ Object
102 103 104 |
# File 'lib/PageTemplate/commands.rb', line 102 def add(block) raise ArgumentError, 'StackableCommand should not be called directly' end |
#end ⇒ Object
93 94 |
# File 'lib/PageTemplate/commands.rb', line 93 def end end |
#to_s ⇒ Object
105 106 107 |
# File 'lib/PageTemplate/commands.rb', line 105 def to_s "[ #{@called_as} ]" end |