module RuboCop::AST::PredicateOperatorNode

Common functionality for nodes that are predicates: `or`, `and` …

Constants

LOGICAL_AND
LOGICAL_OR
SEMANTIC_AND
SEMANTIC_OR

Public Instance Methods

logical_operator?() click to toggle source

Checks whether this is a logical operator.

@return [Boolean] whether this is a logical operator

# File lib/rubocop/ast/node/mixin/predicate_operator_node.rb, line 22
def logical_operator?
  operator == LOGICAL_AND || operator == LOGICAL_OR
end
operator() click to toggle source

Returns the operator as a string.

@return [String] the operator

# File lib/rubocop/ast/node/mixin/predicate_operator_node.rb, line 15
def operator
  loc.operator.source
end
semantic_operator?() click to toggle source

Checks whether this is a semantic operator.

@return [Boolean] whether this is a semantic operator

# File lib/rubocop/ast/node/mixin/predicate_operator_node.rb, line 29
def semantic_operator?
  operator == SEMANTIC_AND || operator == SEMANTIC_OR
end