Class: Rook::Cooking
- Inherits:
-
Object
- Object
- Rook::Cooking
- Defined in:
- lib/rook/kitchen.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#cooked ⇒ Object
readonly
Returns the value of attribute cooked.
-
#goal_product ⇒ Object
readonly
Returns the value of attribute goal_product.
Instance Method Summary collapse
- #cooked?(product) ⇒ Boolean
- #finish(recipe) ⇒ Object
-
#initialize(goal_product) ⇒ Cooking
constructor
A new instance of Cooking.
- #now_cooking?(product) ⇒ Boolean
- #start(recipe) ⇒ Object
Constructor Details
#initialize(goal_product) ⇒ Cooking
Returns a new instance of Cooking.
670 671 672 673 674 |
# File 'lib/rook/kitchen.rb', line 670 def initialize(goal_product) @goal_product = goal_product @cooked = {} @now_cooking = {} end |
Instance Attribute Details
#cooked ⇒ Object (readonly)
Returns the value of attribute cooked.
675 676 677 |
# File 'lib/rook/kitchen.rb', line 675 def cooked @cooked end |
#goal_product ⇒ Object (readonly)
Returns the value of attribute goal_product.
675 676 677 |
# File 'lib/rook/kitchen.rb', line 675 def goal_product @goal_product end |
Instance Method Details
#cooked?(product) ⇒ Boolean
678 679 680 |
# File 'lib/rook/kitchen.rb', line 678 def cooked?(product) return @cooked.key?(product) end |
#finish(recipe) ⇒ Object
695 696 697 698 699 |
# File 'lib/rook/kitchen.rb', line 695 def finish(recipe) recipe.all_products.each do |prod| @cooked[prod] = @now_cooking.delete(prod) end end |
#now_cooking?(product) ⇒ Boolean
683 684 685 |
# File 'lib/rook/kitchen.rb', line 683 def now_cooking?(product) return @now_cooking.key?(product) end |
#start(recipe) ⇒ Object
688 689 690 691 692 |
# File 'lib/rook/kitchen.rb', line 688 def start(recipe) recipe.all_products.each do |prod| @now_cooking[prod] = recipe end end |