Class: Synvert::Core::Rewriter::IfExistCondition

Inherits:
Condition
  • Object
show all
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

Methods inherited from Condition

#initialize, #process

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.

Returns:

  • (Boolean)


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