Module: PrintUtils

Included in:
NbaRoster, NbaSchedule, NbaTeamList
Defined in:
lib/espnscrape/PrintUtils.rb

Overview

Print Utilities

Instance Method Summary collapse

Instance Method Details

#asTable(args, col_width = 15, title = '', show_idx = true) ⇒ String

Printable tabular String representation of args data



9
10
11
12
13
14
15
16
17
18
# File 'lib/espnscrape/PrintUtils.rb', line 9

def asTable(args, col_width = 15, title = '', show_idx = true)
  result = "\n#{title}"
  idx_width = args.size.to_s.length
  args.each_with_index do |row, idx|
    result << "\n#{idx + 1}." + ' ' * pad(idx_width, idx) + '  ' if show_idx
    result << "\n" unless show_idx
    formatRow(row, col_width, result)
  end
  result << "\n"
end