Class: Brandish::Processors::All::Literal
- Inherits:
-
Brandish::Processor::Base
- Object
- Brandish::Processor::Base
- Brandish::Processors::All::Literal
- Includes:
- Brandish::Processor::Block
- Defined in:
- lib/brandish/processors/all/literal.rb
Overview
Takes the contents of the block, and outputs it, without any processing. This is used to bypass any text processing processors that are being used. This does nothing for command or block elements in the literal block, and the existance of such elements will cause errors.
Because of the way the parser works, the original source text information is discarded for command and block elements, since they are unneeded for building the nodes. This means that it is not possible to reconstruct, from only the AST, the original text without slight variances (which we don't want). (The other option would be to use the location information to grab it from the file itself, but as of right now, location information is unreliable.) This is why the literal tag cannot contain other command or block elements.
This processor takes no options, nor any pairs.
Instance Attribute Summary
Attributes inherited from Brandish::Processor::Base
Instance Method Summary collapse
-
#perform ⇒ ::String
Preforms the literalizing of the body.
Methods included from Brandish::Processor::Block
Methods inherited from Brandish::Processor::Base
#accept, #call, #initialize, #postprocess, #process_block, #process_command, #process_root, #process_text, register, #setup
Constructor Details
This class inherits a constructor from Brandish::Processor::Base
Instance Method Details
#perform ⇒ ::String
Preforms the literalizing of the body. Right now, this just uses Brandish::Parser::Node::Root#flatten.
36 37 38 |
# File 'lib/brandish/processors/all/literal.rb', line 36 def perform @body.flatten end |