class Querly::Pattern::Kind::Conditional

Public Instance Methods

conditional?(pair) click to toggle source
# File lib/querly/pattern/kind.rb, line 34
def conditional?(pair)
  node = pair.node
  parent = pair.parent&.node

  case parent&.type
  when :if
    node.equal? parent.children.first
  when :while
    node.equal? parent.children.first
  when :and
    node.equal? parent.children.first
  when :or
    node.equal? parent.children.first
  when :csend
    node.equal? parent.children.first
  else
    false
  end
end
test_kind(pair) click to toggle source
# File lib/querly/pattern/kind.rb, line 30
def test_kind(pair)
  !negated == !!conditional?(pair)
end