Module: TablePuts

Extended by:
Configuration
Defined in:
lib/table_puts.rb

Defined Under Namespace

Classes: Printer

Class Method Summary collapse

Methods included from Configuration

configuration, define_setting

Class Method Details

.call(data, min_width: self.min_column_width, max_width: self.max_column_width) ⇒ Object

Takes in data in the form of an array of hashes all with the same keys and prints a nice looking table



18
19
20
# File 'lib/table_puts.rb', line 18

def self.call(data, min_width: self.min_column_width, max_width: self.max_column_width)
  Printer.new(data, min_width, max_width).call
end

.csv(path, min_width: self.min_column_width, max_width: self.max_column_width) ⇒ Object

Takes in the file path of a CSV and prints a nice looking table



23
24
25
# File 'lib/table_puts.rb', line 23

def self.csv(path, min_width: self.min_column_width, max_width: self.max_column_width)
  Printer.new(read_csv(path), min_width, max_width).call
end