Class: Synvert::Core::Rewriter::UnlessExistCondition

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

Overview

UnlessExistCondition checks if matching node doesn't exist 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 none of child node matches the rules.

Returns:

  • (Boolean)

7
8
9
10
11
12
13
# File 'lib/synvert/core/rewriter/condition/unless_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