fixes #56 by accounting for case that would produce zero rows

dev
Melody 2015-07-08 22:11:55 -04:00
parent e43f68d323
commit 4bc8ba7455
1 changed files with 5 additions and 1 deletions

View File

@ -221,7 +221,11 @@ module Squib
def rowify(opts) def rowify(opts)
unless opts[:rows].respond_to? :to_i unless opts[:rows].respond_to? :to_i
raise "Columns must be an integer" unless opts[:columns].respond_to? :to_i raise "Columns must be an integer" unless opts[:columns].respond_to? :to_i
opts[:rows] = (@cards.size / opts[:columns].to_i).ceil if @cards.size < opts[:columns].to_i
opts[:rows] = 1
else
opts[:rows] = (@cards.size / opts[:columns].to_i).ceil
end
end end
opts opts
end end