class Synvert::Core::Rewriter::IfOnlyExistCondition

IfOnlyExistCondition checks if node has only one child node and the child node matches rules.

Public Instance Methods

match?() click to toggle source

check if only have one child node and the child node matches rules.

# File lib/synvert/core/rewriter/condition/if_only_exist_condition.rb, line 7
def match?
  @instance.current_node.body.size == 1 && @instance.current_node.body.first.match?(@rules)
end