Class: RuboCop::Cop::CopStore

Inherits:
Array
  • Object
show all
Defined in:
lib/rubocop/cop/cop.rb

Overview

Store for all cops with helper functions

Instance Method Summary collapse

Instance Method Details

#typesArray<String>

Returns list of types for current cops.

Returns:

  • (Array<String>)

    list of types for current cops.



11
12
13
14
# File 'lib/rubocop/cop/cop.rb', line 11

def types
  @types = map(&:cop_type).uniq! unless defined? @types
  @types
end

#with_type(type) ⇒ Array<Cop>

Returns Cops for that specific type.

Returns:

  • (Array<Cop>)

    Cops for that specific type.



17
18
19
# File 'lib/rubocop/cop/cop.rb', line 17

def with_type(type)
  select { |c| c.cop_type == type }
end

#without_type(type) ⇒ Array<Cop>

Returns Cops not for a specific type.

Returns:

  • (Array<Cop>)

    Cops not for a specific type.



22
23
24
# File 'lib/rubocop/cop/cop.rb', line 22

def without_type(type)
  reject { |c| c.cop_type == type }
end