print_square 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/lib/print_square/printer.rb +9 -2
- data/lib/print_square/version.rb +1 -1
- metadata +1 -1
data/Gemfile
CHANGED
data/lib/print_square/printer.rb
CHANGED
@@ -10,9 +10,16 @@ module PrintSquare
|
|
10
10
|
|
11
11
|
def out
|
12
12
|
column_sizes = @matrix.first.map(&:to_s).map(&:size)
|
13
|
-
|
13
|
+
|
14
|
+
out_rows = []
|
15
|
+
@matrix.each do |row|
|
16
|
+
row.each_with_index do |cell,i|
|
17
|
+
row[i] = cell.to_s.rjust(column_sizes[i])
|
18
|
+
end
|
19
|
+
out_rows << [row.join(' ')]
|
20
|
+
end
|
21
|
+
puts out_rows.join("\n")
|
14
22
|
end
|
15
23
|
end
|
16
|
-
|
17
24
|
end
|
18
25
|
|
data/lib/print_square/version.rb
CHANGED