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



32
33
34
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 32

def logical_operator?
  LOGICAL_OPERATORS.include?(operator)
end

#operatorString

Returns the operator as a string.

Returns:

  • (String)

    the operator



25
26
27
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 25

def operator
  loc.operator.source
end

#semantic_operator?Boolean

Checks whether this is a semantic operator.

Returns:

  • (Boolean)

    whether this is a semantic operator



39
40
41
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 39

def semantic_operator?
  SEMANTIC_OPERATORS.include?(operator)
end