Sha256: ef5ef10a543813843c12ba5a78385edcf0481851e82e468114d2072229102104

Contents?: true

Size: 460 Bytes

Versions: 9

Compression:

Stored size: 460 Bytes

Contents

# frozen_string_literal: true

require 'tty-table'

module Dri
  module Utils
    module Table
      def print_table(headers, rows, alignments: [], **kwargs)
        if alignments.empty?
          (1..headers.size).each do
            alignments.push(:center)
          end
        end

        table = TTY::Table.new(headers, rows)
        puts table.render(:ascii, resize: true, multiline: true, alignments: alignments, **kwargs)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dri-0.11.0 lib/dri/utils/table.rb
dri-0.10.2 lib/dri/utils/table.rb
dri-0.10.1 lib/dri/utils/table.rb
dri-0.10.0 lib/dri/utils/table.rb
dri-0.9.0 lib/dri/utils/table.rb
dri-0.8.0 lib/dri/utils/table.rb
dri-0.7.0 lib/dri/utils/table.rb
dri-0.6.1 lib/dri/utils/table.rb
dri-0.6.0 lib/dri/utils/table.rb