Method: TTY::Table::Transformation.extract_tuples

Defined in:
lib/tty/table/transformation.rb

.extract_tuples(args) ⇒ Object

Extract the header and row tuples from the value

Parameters:

  • args (Array)

Returns:

  • (Object)


18
19
20
21
22
23
24
25
# File 'lib/tty/table/transformation.rb', line 18

def self.extract_tuples(args)
  rows   = args.pop
  header = args.size.zero? ? nil : args.first
  if rows.first.is_a?(Hash)
    header, rows = group_header_and_rows(rows)
  end
  { header: header, rows: rows }
end