Class: Synvert::Rewriter::IfOnlyExistCondition
- Defined in:
- lib/synvert/rewriter/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::Rewriter::Condition
Instance Method Details
#match? ⇒ Boolean
check if only have one child node and the child node matches rules.
51 52 53 54 |
# File 'lib/synvert/rewriter/condition.rb', line 51 def match? @instance.current_node.body.size == 1 && @instance.current_node.body.first.match?(@instance, @rules) end |