Sha256: c20ee560536e9fe8110d1074ac75ea25c9af5a95436d8dd984394db56a58579f
Contents?: true
Size: 963 Bytes
Versions: 2
Compression:
Stored size: 963 Bytes
Contents
# frozen_string_literal: true module TTY class Table # A class representing table orientation class Orientation # A class responsible for vertical table transformation class Vertical < Orientation # Rotate table vertically # # @param [Table] table # # @return [nil] # # @api public def transform(table) table.rotate_vertical end # Slice horizontal table data into vertical # # @param [Table] table # # @api public def slice(table) header = table.header rows_size = table.rows_size head = header ? header : (0..rows_size).map { |n| (n + 1).to_s } (0...rows_size).reduce([]) do |array, index| array + head.zip(table.rows[index]).map { |row| table.to_row(row) } end end end # Vertical end # Orientation end # Table end # TTY
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-table-0.12.0 | lib/tty/table/orientation/vertical.rb |
tty-table-0.11.0 | lib/tty/table/orientation/vertical.rb |