class Rake::Funnel::Support::Timing::Report::Column
Attributes
header[R]
Public Class Methods
new(stats: [], header: '', accessor: ->(_) { '' }
click to toggle source
# File lib/rake/funnel/support/timing/report.rb, line 13 def initialize(stats: [], header: '', accessor: ->(_) { '' }) @stats = stats @header = header @accessor = accessor end
Public Instance Methods
format_header()
click to toggle source
# File lib/rake/funnel/support/timing/report.rb, line 26 def format_header @header.ljust(width) end
format_value(value)
click to toggle source
# File lib/rake/funnel/support/timing/report.rb, line 30 def format_value(value) @accessor.call(value).ljust(width) end
width()
click to toggle source
# File lib/rake/funnel/support/timing/report.rb, line 19 def width longest_value = @stats.map { |s| @accessor.call(s) }.max_by(&:length) || '' width = longest_value.length width = @header.length if width < @header.length width end