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 CHANGED
@@ -5,4 +5,5 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'rspec'
8
+ gem 'ruby-prof'
8
9
  end
@@ -10,9 +10,16 @@ module PrintSquare
10
10
 
11
11
  def out
12
12
  column_sizes = @matrix.first.map(&:to_s).map(&:size)
13
- @matrix.each{|r| r.each_with_index{|c,i| print "#{' ' if i > 0}%#{column_sizes[i]}s" % c}; puts}
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
 
@@ -1,3 +1,3 @@
1
1
  module PrintSquare
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: print_square
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: