Class: Udb::LogLevel

Inherits:
T::Enum
  • Object
show all
Includes:
Comparable
Defined in:
lib/udb/log.rb

Constant Summary collapse

Debug =
new("debug")
Info =
new("info")
Warn =
new("warn")
Error =
new("error")
Fatal =
new("fatal")

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



40
41
42
43
44
# File 'lib/udb/log.rb', line 40

def <=>(other)
  return nil unless other.is_a?(LogLevel)

  rank <=> other.rank
end

#rankInteger

Returns:

  • (Integer)


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/udb/log.rb', line 28

def rank
  case self
  when Debug then 5
  when Info then 4
  when Warn then 3
  when Error then 2
  when Fatal then 1
  else
    T.absurd(self)
  end
end