46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/glib-main.rb', line 46
def self.tableprint(array)
if not array.kind_of?(Array) then raise TypeError end
long = 0
for i in 0..array.length - 1
for j in 0..array[i].length - 1
if array[i][j].to_s.length > long
long = array[i][j].to_s.length
end
end
end
for i in 0..array.length - 1
for j in 0..array[i].length - 1
spaces = " "
for k in 1..long - array[i][j].to_s.length
spaces = spaces + " "
end
print array[i][j].to_s + spaces
end
puts ""
end
end
|