Class: Faceter::Rules::PrependNested Private
- Inherits:
-
AbstractMapper::PairRule
- Object
- AbstractMapper::PairRule
- Faceter::Rules::PrependNested
- Defined in:
- lib/faceter/rules/prepend_nested.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Optimizes AST by moving nested nodes from the array level to one level deeper:
Instance Method Summary collapse
- #optimize ⇒ Object private
- #optimize? ⇒ Boolean private
Instance Method Details
#optimize ⇒ Object
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.
43 44 45 |
# File 'lib/faceter/rules/prepend_nested.rb', line 43 def optimize Nodes::List.new { (left.nested ? [left] : []) + right.entries } end |
#optimize? ⇒ Boolean
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.
38 39 40 |
# File 'lib/faceter/rules/prepend_nested.rb', line 38 def optimize? left.respond_to?(:nested) && right.instance_of?(Nodes::List) end |