Class: Synvert::Core::Rewriter::IfExistCondition
- Defined in:
- lib/synvert/core/rewriter/condition/if_exist_condition.rb
Overview
IfExistCondition checks if matching node exists in the node children.
Instance Method Summary collapse
-
#match? ⇒ Boolean
check if any child node matches the rules.
Methods inherited from Condition
Constructor Details
This class inherits a constructor from Synvert::Core::Rewriter::Condition
Instance Method Details
#match? ⇒ Boolean
check if any child node matches the rules.
7 8 9 10 11 12 13 |
# File 'lib/synvert/core/rewriter/condition/if_exist_condition.rb', line 7 def match? match = false @instance.current_node.recursive_children do |child_node| match = match || (child_node && child_node.match?(@rules)) end match end |