Class: Faceter::Rules::MergeBranches Private
- Inherits:
-
AbstractMapper::PairRule
- Object
- AbstractMapper::PairRule
- Faceter::Rules::MergeBranches
- Defined in:
- lib/faceter/rules/merge_branches.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.
Merges two consecutive branches of the same type
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.
23 24 25 |
# File 'lib/faceter/rules/merge_branches.rb', line 23 def optimize __left_node__.new(__left_attributes__) { nodes.flat_map(&: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.
16 17 18 19 20 |
# File 'lib/faceter/rules/merge_branches.rb', line 16 def optimize? left.is_a?(AbstractMapper::Branch) && right.class.equal?(__left_node__) && right.attributes.eql?(__left_attributes__) end |