Sha256: 1b3479bbfb0c62b430d84eeee24fde3f64ab51a17a57b2979b7ea5191657db75

Contents?: true

Size: 438 Bytes

Versions: 4

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core
  # UnlessExistCondition checks if matching node doesn't exist in the node children.
  class Rewriter::UnlessExistCondition < Rewriter::Condition
    # check if none of child node matches the rules.
    def match?
      match = false
      @instance.current_node.recursive_children do |child_node|
        match ||= (child_node&.match?(@rules))
      end
      !match
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
synvert-core-0.20.1 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-0.20.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-0.19.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-0.18.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb