Parent

Included Modules

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Severity

Severity class is simple value object about severity

Constants

CODE_TABLE

@api private

NAMES

@api private

Attributes

name[R]

@api public

@!attribute [r] name

@return [Symbol]

severity.
any of `:refactor`, `:convention`, `:warning`, `:error` or `:fatal`.

Public Class Methods

name_from_code(code) click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 25
def self.name_from_code(code)
  name = code.to_sym
  CODE_TABLE[name] || name
end
new(name_or_code) click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 31
def initialize(name_or_code)
  name = Severity.name_from_code(name_or_code)
  unless NAMES.include?(name)
    fail ArgumentError, "Unknown severity: #{name}"
  end
  @name = name.freeze
  freeze
end

Public Instance Methods

<=>(other) click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 70
def <=>(other)
  level <=> other.level
end
==(other) click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 56
def ==(other)
  if other.is_a?(Symbol)
    @name == other
  else
    @name == other.name
  end
end
code() click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 46
def code
  @name.to_s[0].upcase
end
hash() click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 65
def hash
  @name.hash
end
level() click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 51
def level
  NAMES.index(name) + 1
end
to_s() click to toggle source

@api private

# File lib/rubocop/cop/severity.rb, line 41
def to_s
  @name.to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.