Sha256: 04c5cc39067d233a2c4b0205ae9d64cbe78140c7137da953b4ef184c8e6b1296

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

class Server
  def initialize(kitchen)
    @kitchen = kitchen
    @accountant = kitchen.accountant
  end
  attr_reader :kitchen
  attr_accessor :customer
  
  def order_food(food)
    puts "I'll put that order in for you right now"
    sleep(2)
    kitchen.make_food(food)
    serve_food(food)
  end
  
  def serve_food(food)
    retrieve_food(food)
    sleep(2)
    puts " <Server retrieved #{food}>"
    return_to_customer(food)
  end
  
  def retrieve_food(food)
    kitchen.provide_food(food)
  end
  
  def return_to_customer(food)
    puts "Here's your order of #{food}"
  end
  
  def pay_bill
    @accountant.accept_funds
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
direction-0.0.5 sample/server.rb