Class: PVN::Log::EntryFormatter
- Inherits:
-
Formatter
- Object
- ColorFormatter
- Formatter
- PVN::Log::EntryFormatter
- Defined in:
- lib/pvn/log/formatter/entry_formatter.rb
Constant Summary
Constants inherited from Formatter
Formatter::COLORS, Formatter::WIDTHS
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#from_head ⇒ Object
readonly
Returns the value of attribute from_head.
-
#from_tail ⇒ Object
readonly
Returns the value of attribute from_tail.
-
#idx ⇒ Object
readonly
Returns the value of attribute idx.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from Formatter
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(use_colors, entry, idx, from_head, from_tail, total) ⇒ EntryFormatter
constructor
A new instance of EntryFormatter.
Methods inherited from Formatter
Methods inherited from ColorFormatter
Constructor Details
#initialize(use_colors, entry, idx, from_head, from_tail, total) ⇒ EntryFormatter
Returns a new instance of EntryFormatter.
19 20 21 22 23 24 25 26 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 19 def initialize use_colors, entry, idx, from_head, from_tail, total super use_colors @entry = entry @idx = idx @from_head = from_head @from_tail = from_tail @total = total end |
Instance Attribute Details
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
13 14 15 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 13 def entry @entry end |
#from_head ⇒ Object (readonly)
Returns the value of attribute from_head.
15 16 17 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 15 def from_head @from_head end |
#from_tail ⇒ Object (readonly)
Returns the value of attribute from_tail.
16 17 18 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 16 def from_tail @from_tail end |
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
14 15 16 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 14 def idx @idx end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
17 18 19 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 17 def total @total end |
Instance Method Details
#format ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pvn/log/formatter/entry_formatter.rb', line 28 def format lines = Array.new sf = SummaryFormatter.new use_colors, entry, idx, from_head, from_tail, total lines << sf.format lines << "" mf = MessageFormatter.new use_colors, entry. lines << mf.format lines << "" pf = PathFormatter.new use_colors, entry.paths lines.concat pf.format lines end |