Module: RuboCop::AST::PredicateOperatorNode
Overview
Common functionality for nodes that are predicates: ‘or`, `and` …
Constant Summary collapse
- LOGICAL_AND =
'&&'.freeze
- SEMANTIC_AND =
'and'.freeze
- LOGICAL_OR =
'||'.freeze
- SEMANTIC_OR =
'or'.freeze
Instance Method Summary collapse
-
#logical_operator? ⇒ Boolean
Checks whether this is a logical operator.
-
#operator ⇒ String
Returns the operator as a string.
-
#semantic_operator? ⇒ Boolean
Checks whether this is a semantic operator.
Instance Method Details
#logical_operator? ⇒ Boolean
Checks whether this is a logical operator.
23 24 25 |
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 23 def logical_operator? operator == LOGICAL_AND || operator == LOGICAL_OR end |
#operator ⇒ String
Returns the operator as a string.
16 17 18 |
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 16 def operator loc.operator.source end |
#semantic_operator? ⇒ Boolean
Checks whether this is a semantic operator.
30 31 32 |
# File 'lib/rubocop/ast/node/mixin/predicate_operator_node.rb', line 30 def semantic_operator? operator == SEMANTIC_AND || operator == SEMANTIC_OR end |