class S3tatistic::Formatter

Public Class Methods

format_bucket_info(bucket) click to toggle source
# File lib/s3tatistic/formatter.rb, line 17
def format_bucket_info(bucket)
end
format_buckets(buckets, options) click to toggle source
# File lib/s3tatistic/formatter.rb, line 6
def format_buckets(buckets, options)
  first, = buckets
  headers = first.keys
  rows = buckets
           .map(&:values)
           .map { |b| format_size(b, options.block) }

  table = TTY::Table.new(headers, rows)
  table.render(:basic)
end
format_size(values, format) click to toggle source
# File lib/s3tatistic/formatter.rb, line 20
def format_size(values, format)
  puts "values[3] : #{values[3]}"
  formatted = Humanize::Byte.new(values[3]).public_send("to_#{format}")
  values[3] = "#{formatted} #{format}b"
  values
end