Class: Vvm::State::EmptyBalance

Inherits:
Base
  • Object
show all
Defined in:
lib/vvm/state/empty_balance.rb

Instance Method Summary collapse

Methods inherited from Base

#dispense, #initialize

Constructor Details

This class inherits a constructor from Vvm::State::Base

Instance Method Details

#insert(coin) ⇒ Object



6
7
8
9
10
# File 'lib/vvm/state/empty_balance.rb', line 6

def insert(coin)
  machine.balance += coin
  machine.state = Vvm::State::PositiveBalance.new(machine) unless coin <= 0
  machine
end

#pick(_product_name) ⇒ Object



12
13
14
# File 'lib/vvm/state/empty_balance.rb', line 12

def pick(_product_name)
  raise InsufficientBalance
end