Module: RuboCop::AST::PredicateOperatorNode

Included in:
AndNode, OrNode
Defined in:
lib/rubocop/ast/node/mixin/predicate_operator_node.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#logical_operator?Boolean

Checks whether this is a logical operator.

Returns:

  • (Boolean)

    whether this is a logical operator



27
28
29
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 27

def logical_operator?
  operator == LOGICAL_AND || operator == LOGICAL_OR
end

#operatorString

Returns the operator as a string.

Returns:

  • (String)

    the operator



20
21
22
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 20

def operator
  loc.operator.source
end

#semantic_operator?Boolean

Checks whether this is a semantic operator.

Returns:

  • (Boolean)

    whether this is a semantic operator



34
35
36
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 34

def semantic_operator?
  operator == SEMANTIC_AND || operator == SEMANTIC_OR
end