I want to return any items that are cheap, which should return any items that cost less than $300.
This is the main class;
class ShoesInventory
def initialize(items)
@items = items
end
def cheap
# this is my solution, but it just print out an array of boolean
@items.map { |item| item[:price] < 30 }
# to be implemented
end
end
This is an instance of the class ;
ShoesInventory.new([
{price: 101.00, name: "Nike Air Force 1 Low"}},
{price: 232.00, name: "Jordan 4 Retro"},
{price: 230.99, name: "adidas Yeezy Boost 350 V2"},
{price: 728.00, name: "Nike Dunk Low"}
]).cheap
I want the result to be like this;
# => [
# {price: 101.00, name: "Nike Air Force 1 Low"}},
# {price: 232.00, name: "Jordan 4 Retro"},
# {price: 230.99, name: "adidas Yeezy Boost 350 V2"},
# ]
Can you guide me ?