Class: CheckstyleReports::Severity

Inherits:
Object
  • Object
show all
Defined in:
lib/checkstyle_reports/lib/severity.rb

Constant Summary collapse

VALUES =
%i(ignore info warning error).freeze

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ Severity

Returns a new instance of Severity.



7
8
9
# File 'lib/checkstyle_reports/lib/severity.rb', line 7

def initialize(base)
  @base = base&.to_sym
end

Instance Method Details

#<=(other) ⇒ Object



11
12
13
14
15
16
# File 'lib/checkstyle_reports/lib/severity.rb', line 11

def <=(other)
  return if @base.nil?
  return true if other.nil?

  VALUES.index(@base) <= VALUES.index(other.to_sym)
end