Class: Lumberjack::Severity::Data

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

Overview

Data object for severity levels that includes variations on the label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, label, emoji, terminal_color) ⇒ Data

Returns a new instance of Data.



23
24
25
26
27
28
29
30
# File 'lib/lumberjack/severity.rb', line 23

def initialize(level, label, emoji, terminal_color)
  @level = level
  @label = label.freeze
  @padded_label = label.ljust(5).freeze
  @char = label[0].freeze
  @emoji = emoji.freeze
  @terminal_color = "\e[38;5;#{terminal_color}m"
end

Instance Attribute Details

#charObject (readonly)

Returns the value of attribute char.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def char
  @char
end

#emojiObject (readonly)

Returns the value of attribute emoji.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def emoji
  @emoji
end

#labelObject (readonly)

Returns the value of attribute label.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def label
  @label
end

#levelObject (readonly)

Returns the value of attribute level.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def level
  @level
end

#padded_labelObject (readonly)

Returns the value of attribute padded_label.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def padded_label
  @padded_label
end

#terminal_colorObject (readonly)

Returns the value of attribute terminal_color.



21
22
23
# File 'lib/lumberjack/severity.rb', line 21

def terminal_color
  @terminal_color
end