Class: Lumberjack::Severity::Data
- Inherits:
-
Object
- Object
- Lumberjack::Severity::Data
- Defined in:
- lib/lumberjack/severity.rb
Overview
Data object for severity levels that includes variations on the label.
Instance Attribute Summary collapse
-
#char ⇒ Object
readonly
Returns the value of attribute char.
-
#emoji ⇒ Object
readonly
Returns the value of attribute emoji.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#padded_label ⇒ Object
readonly
Returns the value of attribute padded_label.
-
#terminal_color ⇒ Object
readonly
Returns the value of attribute terminal_color.
Instance Method Summary collapse
-
#initialize(level, label, emoji, terminal_color) ⇒ Data
constructor
A new instance of Data.
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
#char ⇒ Object (readonly)
Returns the value of attribute char.
21 22 23 |
# File 'lib/lumberjack/severity.rb', line 21 def char @char end |
#emoji ⇒ Object (readonly)
Returns the value of attribute emoji.
21 22 23 |
# File 'lib/lumberjack/severity.rb', line 21 def emoji @emoji end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
21 22 23 |
# File 'lib/lumberjack/severity.rb', line 21 def label @label end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
21 22 23 |
# File 'lib/lumberjack/severity.rb', line 21 def level @level end |
#padded_label ⇒ Object (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_color ⇒ Object (readonly)
Returns the value of attribute terminal_color.
21 22 23 |
# File 'lib/lumberjack/severity.rb', line 21 def terminal_color @terminal_color end |