Range option shouldn't fail on []

Fixes #107
This commit is contained in:
Andy Meneely
2015-10-13 15:01:14 -04:00
parent c976772b9e
commit e8d7480a63
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ module Squib
input = 0..(deck_size - 1) if input == :all
input = (input.to_i)..(input.to_i) if input.respond_to? :to_i
raise ArgumentError.new("#{input} must be Enumerable (i.e. respond_to :each).") unless input.respond_to? :each
raise ArgumentError.new("#{input} is outside of deck range of 0..#{deck_size-1}") if input.max > (deck_size - 1)
raise ArgumentError.new("#{input} is outside of deck range of 0..#{deck_size-1}") if (!input.max.nil?) && (input.max > (deck_size - 1))
input
end