class RuboCop::Cop::Severity
Severity
class is simple value object about severity
Constants
- CODE_TABLE
-
@api private
- NAMES
Attributes
@api public
@!attribute [r] name
@return [Symbol]
severity. any of `:info`, `:refactor`, `:convention`, `:warning`, `:error` or `:fatal`.
Public Class Methods
Source
# File lib/rubocop/cop/severity.rb, line 24 def self.name_from_code(code) name = code.to_sym CODE_TABLE[name] || name end
Source
# File lib/rubocop/cop/severity.rb, line 30 def initialize(name_or_code) name = Severity.name_from_code(name_or_code) raise ArgumentError, "Unknown severity: #{name}" unless NAMES.include?(name) @name = name.freeze freeze end
@api private
Public Instance Methods
Source
# File lib/rubocop/cop/severity.rb, line 62 def <=>(other) level <=> other.level end
Source
# File lib/rubocop/cop/severity.rb, line 50 def ==(other) @name == if other.is_a?(Symbol) other else other.name end end