Class: Synvert::Rewriter::IfExistCondition

Inherits:
Condition
  • Object
show all
Defined in:
lib/synvert/rewriter/condition.rb

Overview

IfExistCondition checks if matching node exists in the node children.

Instance Method Summary collapse

Methods inherited from Condition

#initialize, #process

Constructor Details

This class inherits a constructor from Synvert::Rewriter::Condition

Instance Method Details

#match?Boolean

check if any child node matches the rules.

Returns:

  • (Boolean)


27
28
29
30
31
32
33
# File 'lib/synvert/rewriter/condition.rb', line 27

def match?
  match = false
  @instance.current_node.recursive_children do |child_node|
    match = match || (child_node && child_node.match?(@instance, @rules))
  end
  match
end