Class: ProductCollection
- Inherits:
-
Array
- Object
- Array
- ProductCollection
- Defined in:
- lib/wunder/collections/product_collection.rb
Instance Method Summary collapse
Instance Method Details
#find_by_product_code(code) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/wunder/collections/product_collection.rb', line 2 def find_by_product_code(code) each do |product| @fetch_product = product if product.product_code == code end @fetch_product end |
#validate_product_code_is_uniq(code) ⇒ Object
10 11 12 |
# File 'lib/wunder/collections/product_collection.rb', line 10 def validate_product_code_is_uniq(code) find_by_product_code(code).nil? ? true : (raise "DuplicateProductCodeError") end |