Exception: Tabletop::NotEnoughTokensError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/tabletop/token.rb

Instance Method Summary collapse

Constructor Details

#initialize(wanted, available) ⇒ NotEnoughTokensError

Returns a new instance of NotEnoughTokensError.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/tabletop/token.rb', line 4

def initialize(wanted, available)
  w_t, a_t = "token", "token"
  
  w_t << "s" if wanted > 1 or wanted == 0
  
  a_t << "s" if available > 1 or available == 0
  
  available = available > 0 ? available : "no"
  
  super("tried to remove #{wanted} #{w_t} from a stack with #{available} #{a_t}")
end