Class: Util

Inherits:
Object
  • Object
show all
Defined in:
lib/espnscrape/util.rb

Overview

Debug Utilities

Class Method Summary collapse

Class Method Details

.a2_to_table(args, row_width = 30) ⇒ Object

Print two dimensional array as a string

Parameters:

  • args ([[object]])
  • row_width (Integer) (defaults to: 30)


13
14
15
16
17
18
19
20
21
22
# File 'lib/espnscrape/util.rb', line 13

def self.a2_to_table(args, row_width=30)
	spc = row_width
	args.each do |row|
		row.each do |td|
			print td
			print " "*(spc - td.to_s.length)
		end
		puts
	end
end

.a_to_s(*args) ⇒ String

Print an array as a string

Parameters:

  • args ([object])

Returns:

  • (String)


6
7
8
# File 'lib/espnscrape/util.rb', line 6

def self.a_to_s(*args)
	return args.join(', ')
end

.printTotals(teamTotals) ⇒ String

NbaBoxScore: Print totals row

Parameters:

  • teamTotals ([Integer])

Returns:

  • (String)


27
28
29
30
31
32
33
# File 'lib/espnscrape/util.rb', line 27

def self.printTotals(teamTotals)
	print "Totals:\t\t\t\t\t\t\t\t\t\t"
	teamTotals.each do |cell|
		print "\t\t" + cell + "\t|| "
	end
	puts "\n\n"
end