lib/game_shuffle_cards/validate_game.rb
# Given two values String or Integer, checks whether they are valid in a context Game
# then return the integers values or raise an exception
# @param players [String|Integer]
# @param cards_per_player [String|Integer]
# @return players and cards per player [Array] with integers values of each one
Given two values String or Integer, checks whether they are valid in a context Game
then return the integers values or raise an exception
Given two values String or Integer checks whether they are valid in a context Game then return the integers values or raise an exception
def parse_and_validate(players, cards_per_player)
				begin
					players = Integer(players)
					cards_per_player= Integer(cards_per_player)
				rescue
					raise TypeError
				end
				raise GameShuffleCards::ToManyPlayersError if players > GameShuffleCards::Game::MAXIMUN_PLAYERS
				raise GameShuffleCards::NotEnoughPlayersError if players < GameShuffleCards::Game::MINIMUN_PLAYERS
				raise GameShuffleCards::ToManyCardsPerPlayerError if cards_per_player > GameShuffleCards::Game::TOTAL_CARDS
				raise GameShuffleCards::NotEnoughCardsPerPlayersError if cards_per_player < GameShuffleCards::Game::MINIMUN_CARDS
				raise GameShuffleCards::TooManyCardsDemandedError if (players * cards_per_player) > GameShuffleCards::Game::TOTAL_CARDS
				[players,cards_per_player]
			end
def parse_and_validate ( players , cards_per_player ) begin players = Integer ( players ) cards_per_player = Integer ( cards_per_player ) rescue raise TypeError end raise GameShuffleCards :: ToManyPlayersError if players > GameShuffleCards :: Game :: MAXIMUN_PLAYERS raise GameShuffleCards :: NotEnoughPlayersError if players < GameShuffleCards :: Game :: MINIMUN_PLAYERS raise GameShuffleCards :: ToManyCardsPerPlayerError if cards_per_player > GameShuffleCards :: Game :: TOTAL_CARDS raise GameShuffleCards :: NotEnoughCardsPerPlayersError if cards_per_player < GameShuffleCards :: Game :: MINIMUN_CARDS raise GameShuffleCards :: TooManyCardsDemandedError if ( players * cards_per_player ) > GameShuffleCards :: Game :: TOTAL_CARDS [ players , cards_per_player ] end
Given two values String or Integer, checks whether they are valid in a context Game
then return the integers values or raise an exception
Given two values String or Integer checks whether they are valid in a context Game then return the integers values or raise an exception
players and cards per player  with integers values of each one
players and cards per player with integers values of each one
Array
players
<not_specific>
cards_per_player
<not_specific>
<not_specific>
None