Class: Synvert::Core::Rewriter::IfOnlyExistCondition
- Defined in:
- lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
Overview
IfExistCondition checks if node has only one child node and the child node matches rules.
Instance Method Summary collapse
-
#match? ⇒ Boolean
check if only have one child node and the child node matches rules.
Methods inherited from Condition
Constructor Details
This class inherits a constructor from Synvert::Core::Rewriter::Condition
Instance Method Details
#match? ⇒ Boolean
check if only have one child node and the child node matches rules.
7 8 9 10 |
# File 'lib/synvert/core/rewriter/condition/if_only_exist_condition.rb', line 7 def match? @instance.current_node.body.size == 1 && @instance.current_node.body.first.match?(@rules) end |