Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Instructions

You're continuing to work on the stock management system you built previously. Since discovering `OpenStruct` and block shortcuts, you've decided to refactor the code a little. Rather than storing the items as hashes, you're going to utilize your newfound skills.
You're continuing to work on the stock management system you built previously.
Since discovering `OpenStruct` and block shortcuts, you've decided to refactor the code a little.
Rather than storing the items as hashes, you're going to utilize your newfound skills.

## 1. Allow retrievable of items

Expand All @@ -24,7 +26,7 @@ inventory.items.size
# => 4
```

# 2. Refactor `item_names`
## 2. Refactor `item_names`

Refactor `item_names` to use the new block shortcut you've learnt rather than hashes.
As a reminder, the method should return:
Expand All @@ -40,11 +42,10 @@ BoutiqueInventory.new([
# => ["Bamboo Socks Cats", "Black Short Skirt", "Maxi Brown Dress", "Red Short Skirt"]
```

## 3. Refactor `total_stock`

# 2. Refactor `total_stock`

Refactor `total_stock` to use the openstruct's method, rather than referencing a hash.
As a reminder, the method should return::
Refactor `total_stock` to use the OpenStruct's method, rather than referencing a hash.
As a reminder, the method should return:

```ruby
BoutiqueInventory.new([
Expand Down