Class: Unparser::Preprocessor::Begin
- Inherits:
-
Unparser::Preprocessor
- Object
- Unparser::Preprocessor
- Unparser::Preprocessor::Begin
- Defined in:
- lib/unparser/preprocessor.rb
Overview
Preprocessor for begin nodes. Removes begin nodes with one child.
This reduces the amount of complex logic needed inside unparser to emit “nice” syntax with minimal tokens.
Constant Summary
Constants inherited from Unparser::Preprocessor
Instance Method Summary collapse
-
#result ⇒ Parser::AST::Node
private
Return preprocessor result.
Methods inherited from Unparser::Preprocessor
Methods included from NodeHelpers
Instance Method Details
#result ⇒ Parser::AST::Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return preprocessor result
223 224 225 226 227 228 229 |
# File 'lib/unparser/preprocessor.rb', line 223 def result if children.one? && !parent_type.equal?(:regexp) visit(children.first) else Noop.call(node, parent_type) end end |