Sha256: 3c86f5eab6c72956d36c982d2010109534184adf2339f902b514f40c1c004c93

Contents?: true

Size: 908 Bytes

Versions: 6516

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # Common functionality for nodes that are predicates:
    # `or`, `and` ...
    module PredicateOperatorNode
      LOGICAL_AND  = '&&'.freeze
      SEMANTIC_AND = 'and'.freeze
      LOGICAL_OR   = '||'.freeze
      SEMANTIC_OR  = 'or'.freeze

      # Returns the operator as a string.
      #
      # @return [String] the operator
      def operator
        loc.operator.source
      end

      # Checks whether this is a logical operator.
      #
      # @return [Boolean] whether this is a logical operator
      def logical_operator?
        operator == LOGICAL_AND || operator == LOGICAL_OR
      end

      # Checks whether this is a semantic operator.
      #
      # @return [Boolean] whether this is a semantic operator
      def semantic_operator?
        operator == SEMANTIC_AND || operator == SEMANTIC_OR
      end
    end
  end
end

Version data entries

6,516 entries across 6,510 versions & 25 rubygems

Version Path
ory-client-0.0.1.alpha50 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha49 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha48 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha47 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha46 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha45 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha44 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha43 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha42 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha41 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha40 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha39 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha38 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha37 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha36 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-kratos-client-0.8.2.alpha1 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
ory-client-0.0.1.alpha31 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
primary_connect_proto-0.4.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
primary_connect_proto-0.3.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb
primary_connect_proto-0.2.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.66.0/lib/rubocop/ast/node/mixin/predicate_operator_node.rb