Class: Unparser::Preprocessor::CompactDSTR
- Inherits:
-
Unparser::Preprocessor
- Object
- Unparser::Preprocessor
- Unparser::Preprocessor::CompactDSTR
- Defined in:
- lib/unparser/preprocessor.rb
Overview
Preprocessor eliminating unneded dstr nodes
Constant Summary collapse
- MAP =
IceNine.deep_freeze( dstr: :str, dsym: :sym )
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
171 172 173 174 175 176 177 |
# File 'lib/unparser/preprocessor.rb', line 171 def result if children.any? && children.all? { |child| child.type.equal?(:str) } node.updated(MAP.fetch(node.type), [children.map { |child| child.children.first }.join]) else node end end |