Sha256: 72a4cc2a2d40acea46d2d86dfcd5e8be5915b80ea227d379e78d6c07069411f6

Contents?: true

Size: 478 Bytes

Versions: 13

Compression:

Stored size: 478 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
    private

    # check if none of child node matches the rules.
    #
    # return [Boolean]
    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

13 entries across 13 versions & 1 rubygems

Version Path
synvert-core-1.4.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.3.1 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.3.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.2.1 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.2.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.1.1 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.1.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.0.5 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.0.4 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.0.3 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.0.2 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-1.0.1 lib/synvert/core/rewriter/condition/unless_exist_condition.rb
synvert-core-0.64.0 lib/synvert/core/rewriter/condition/unless_exist_condition.rb