Class: LogSinks::Level

Inherits:
Object
  • Object
show all
Defined in:
lib/log_sinks/level.rb

Overview

Log event level.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, val) ⇒ Level

Returns a new instance of Level.



18
19
20
21
# File 'lib/log_sinks/level.rb', line 18

def initialize(name, val)
  @val = val
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/log_sinks/level.rb', line 16

def name
  @name
end

#valObject (readonly)

Returns the value of attribute val.



16
17
18
# File 'lib/log_sinks/level.rb', line 16

def val
  @val
end

Class Method Details

.[](name) ⇒ Object



11
12
13
# File 'lib/log_sinks/level.rb', line 11

def [](name)
  (@s ||= {})[name]
end

.[]=(name, level) ⇒ Object



7
8
9
# File 'lib/log_sinks/level.rb', line 7

def []=(name, level)
  (@s ||= {})[name] = level
end

Instance Method Details

#<(other) ⇒ Object



27
28
29
# File 'lib/log_sinks/level.rb', line 27

def <(other)
  @val < other.val
end

#<=(other) ⇒ Object



31
32
33
# File 'lib/log_sinks/level.rb', line 31

def <=(other)
  @val <= other.val
end

#==(other) ⇒ Object



43
44
45
# File 'lib/log_sinks/level.rb', line 43

def ==(other)
  @val == other.val
end

#>(other) ⇒ Object



35
36
37
# File 'lib/log_sinks/level.rb', line 35

def >(other)
  @val > other.val
end

#>=(other) ⇒ Object



39
40
41
# File 'lib/log_sinks/level.rb', line 39

def >=(other)
  @val >= other.val
end

#to_sObject



23
24
25
# File 'lib/log_sinks/level.rb', line 23

def to_s
  @name.to_s.upcase
end