Class: Workarea::Pricing::Discount::BuySomeGetSome::OrderItemsByProduct::Product

Inherits:
Struct
  • Object
show all
Defined in:
app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#category_idsObject

Returns the value of attribute category_ids

Returns:

  • (Object)

    the current value of category_ids



7
8
9
# File 'app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb', line 7

def category_ids
  @category_ids
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



7
8
9
# File 'app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb', line 7

def id
  @id
end

#itemsObject

Returns the value of attribute items

Returns:

  • (Object)

    the current value of items



7
8
9
# File 'app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb', line 7

def items
  @items
end

#quantityObject

Returns the value of attribute quantity

Returns:

  • (Object)

    the current value of quantity



7
8
9
# File 'app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb', line 7

def quantity
  @quantity
end

Instance Method Details

#matches_categories?(*ids) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb', line 8

def matches_categories?(*ids)
  match_ids = Array(ids).flatten.map(&:to_s)
  (category_ids.map(&:to_s) & match_ids).any?
end