Class: Lutra::Formatters::Default
- Inherits:
-
Base
- Object
- Base
- Lutra::Formatters::Default
show all
- Defined in:
- lib/lutra/formatters/default.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#display(notes) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/lutra/formatters/default.rb', line 4
def display(notes)
indent = notes.map(&:line).flatten.max.to_s.size
notes.group_by { |n| n.file }.each do |file, notes|
puts "#{file[2..-1]}:"
notes.each do |note|
puts " * #{prepare(note, indent)}"
end
puts
end
end
|
#prepare(note, indent) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/lutra/formatters/default.rb', line 16
def prepare(note, indent)
s = "[#{note[:line].to_s.rjust(indent)}] "
s << "[#{note[:tag]}] " if @options[:display_tags]
s << note[:text][0..@options[:text_size]].strip.chomp
s << "..." if note[:text].size > @options[:text_size]
s
end
|