Sha256: 2c64dd753d32151387c7a0f1281b3a030eb4a1c0c9842d4c7cc5b17ddb10e9a5

Contents?: true

Size: 960 Bytes

Versions: 10

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # This module encapsulates the ability to allow certain methods when
    # parsing.
    module AllowedMethods
      private

      # @api public
      def allowed_method?(name)
        allowed_methods.include?(name.to_s)
      end

      # @deprecated Use allowed_method? instead
      alias ignored_method? allowed_method?

      # @api public
      def allowed_methods
        deprecated_values = cop_config_deprecated_values
        if deprecated_values.any?(Regexp)
          cop_config.fetch('AllowedMethods', [])
        else
          Array(cop_config['AllowedMethods']).concat(deprecated_values)
        end
      end

      def cop_config_deprecated_values
        Array(cop_config['IgnoredMethods']).concat(Array(cop_config['ExcludedMethods']))
      end
    end
    # @deprecated IgnoredMethods class has been replaced with AllowedMethods.
    IgnoredMethods = AllowedMethods
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_methods.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_methods.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_methods.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_methods.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_methods.rb
rubocop-1.35.1 lib/rubocop/cop/mixin/allowed_methods.rb
rubocop-1.35.0 lib/rubocop/cop/mixin/allowed_methods.rb
rubocop-1.34.1 lib/rubocop/cop/mixin/allowed_methods.rb
rubocop-1.34.0 lib/rubocop/cop/mixin/allowed_methods.rb
rubocop-1.33.0 lib/rubocop/cop/mixin/allowed_methods.rb