Sha256: 9afbac93286bd6d97e6609056863d26b661d22b4bfb1c678477e5a108c52a304

Contents?: true

Size: 414 Bytes

Versions: 17

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core
  # IfOnlyExistCondition checks if node has only one child node and the child node matches rules.
  class Rewriter::IfOnlyExistCondition < Rewriter::Condition
    # check if only have one child node and the child node matches rules.
    def match?
      @instance.current_node.body.size == 1 && @instance.current_node.body.first.match?(@rules)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
synvert-core-0.63.1 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.63.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.62.1 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.62.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.61.2 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.61.1 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.61.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.60.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.59.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.58.3 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.58.2 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.58.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.57.1 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.57.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.56.1 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.56.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb
synvert-core-0.55.0 lib/synvert/core/rewriter/condition/if_only_exist_condition.rb