Class: PageTemplate::UnknownCommand
- Defined in:
- lib/PageTemplate/commands.rb
Overview
An UnknownCommand is exactly that: A command we know nothing about.
We keep this and save it for future use in case we will know something about it before output is called.
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#initialize(command) ⇒ UnknownCommand
constructor
Save the
command
and theparser
, so we can look it up and hopefully. -
#output(namespace) ⇒ Object
If the command that UnknownCommand is set to exists, find out if the command exists in the Parser’s glossary.
- #to_s ⇒ Object
Constructor Details
#initialize(command) ⇒ UnknownCommand
Save the command
and the parser
, so we can look it up and hopefully
75 76 77 |
# File 'lib/PageTemplate/commands.rb', line 75 def initialize(command) @command = command end |
Instance Method Details
#output(namespace) ⇒ Object
If the command that UnknownCommand is set to exists, find out if the command exists in the Parser’s glossary.
64 65 66 67 68 69 70 71 72 |
# File 'lib/PageTemplate/commands.rb', line 64 def output(namespace) cls = namespace.parser.glossary.lookup(@command) case cls when UnknownCommand "[ Unknown Command: #{@command} ]" else cls.output(namespace) end end |
#to_s ⇒ Object
78 79 80 |
# File 'lib/PageTemplate/commands.rb', line 78 def to_s "[ UnknownCommand: #{@command} ]" end |