Method: Tabletop::TokenStack#remove

Defined in:
lib/tabletop/token.rb

#remove(n = 1) ⇒ Object

Raises NotEnoughTokensError if there aren’t enough tokens to remove

Raises:

  • (ArgumentError)


55
56
57
58
59
60
61
62
63
# File 'lib/tabletop/token.rb', line 55

def remove(n=1)
  raise ArgumentError unless n.respond_to?(:to_i)
  n = n.to_i
  raise ArgumentError if n < 0
  if n > @count
    raise NotEnoughTokensError.new(n, @count)
  end
  @count -= n
end