Class: PVN::Log::EntriesFormatter
- Inherits:
-
Formatter
- Object
- ColorFormatter
- Formatter
- PVN::Log::EntriesFormatter
- Defined in:
- lib/pvn/log/formatter/entries_formatter.rb
Constant Summary
Constants inherited from Formatter
Formatter::COLORS, Formatter::WIDTHS
Instance Attribute Summary collapse
-
#from_head ⇒ Object
readonly
Returns the value of attribute from_head.
-
#from_tail ⇒ Object
readonly
Returns the value of attribute from_tail.
Attributes inherited from Formatter
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(use_color, entries, from_head, from_tail) ⇒ EntriesFormatter
constructor
A new instance of EntriesFormatter.
Methods inherited from Formatter
Methods inherited from ColorFormatter
Constructor Details
#initialize(use_color, entries, from_head, from_tail) ⇒ EntriesFormatter
Returns a new instance of EntriesFormatter.
14 15 16 17 18 19 |
# File 'lib/pvn/log/formatter/entries_formatter.rb', line 14 def initialize use_color, entries, from_head, from_tail super use_color @entries = entries @from_head = from_head @from_tail = from_tail end |
Instance Attribute Details
#from_head ⇒ Object (readonly)
Returns the value of attribute from_head.
11 12 13 |
# File 'lib/pvn/log/formatter/entries_formatter.rb', line 11 def from_head @from_head end |
#from_tail ⇒ Object (readonly)
Returns the value of attribute from_tail.
12 13 14 |
# File 'lib/pvn/log/formatter/entries_formatter.rb', line 12 def from_tail @from_tail end |
Instance Method Details
#format ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pvn/log/formatter/entries_formatter.rb', line 21 def format lines = Array.new total = @entries.size @entries.each_with_index do |entry, idx| ef = EntryFormatter.new use_colors, entry, idx, from_head, from_tail, total lines.concat ef.format lines << '-' * 55 end lines end |