class Ravanello::Formatter

Formats analyzed statistics and render it as string arrays

Public Class Methods

new(statistics) click to toggle source
# File lib/ravanello/formatter.rb, line 8
def initialize(statistics)
  @statistics = statistics
end

Public Instance Methods

call() click to toggle source
# File lib/ravanello/formatter.rb, line 12
def call
  data.map do |path|
    data_item = @statistics.data[path]
    format(
      '%-5s %-5s %s (%s)',
      data_item.count.to_s,
      data_item.size.to_s,
      path.to_s,
      data_item.samples.sample.name
    )
  end
end

Private Instance Methods

data() click to toggle source
# File lib/ravanello/formatter.rb, line 27
def data
  # @statistics.data.keys.sort_by { |k| @statistics.data[k].size }.reverse
  @statistics.data.keys.sort_by(&:to_s)
end