Class: Onlylogs::LogLine
- Inherits:
-
Object
- Object
- Onlylogs::LogLine
- Defined in:
- app/models/onlylogs/log_line.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(number, text) ⇒ LogLine
constructor
A new instance of LogLine.
- #parsed_number ⇒ Object
- #parsed_text ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(number, text) ⇒ LogLine
7 8 9 10 |
# File 'app/models/onlylogs/log_line.rb', line 7 def initialize(number, text) @number = number @text = text end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
5 6 7 |
# File 'app/models/onlylogs/log_line.rb', line 5 def number @number end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'app/models/onlylogs/log_line.rb', line 5 def text @text end |
Instance Method Details
#parsed_number ⇒ Object
12 13 14 |
# File 'app/models/onlylogs/log_line.rb', line 12 def parsed_number number.to_s.reverse.gsub(/(\d{3})(?=\d)/, "\\1'").reverse.rjust(7) end |
#parsed_text ⇒ Object
16 17 18 |
# File 'app/models/onlylogs/log_line.rb', line 16 def parsed_text FilePathParser.parse(AnsiColorParser.parse(ERB::Util.html_escape(text))) end |
#to_a ⇒ Object
20 21 22 |
# File 'app/models/onlylogs/log_line.rb', line 20 def to_a [number, text] end |