From 4bc8ba745559339cf17d8c1b0ac48911de2d211d Mon Sep 17 00:00:00 2001 From: Melody Date: Wed, 8 Jul 2015 22:11:55 -0400 Subject: [PATCH] fixes #56 by accounting for case that would produce zero rows --- lib/squib/input_helpers.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/squib/input_helpers.rb b/lib/squib/input_helpers.rb index fa9dc88..7b0d461 100644 --- a/lib/squib/input_helpers.rb +++ b/lib/squib/input_helpers.rb @@ -221,7 +221,11 @@ module Squib def rowify(opts) unless opts[:rows].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 opts end