Class: Goods::OffersList
- Inherits:
-
Object
- Object
- Goods::OffersList
- Extended by:
- Container
- Defined in:
- lib/goods/offers_list.rb
Instance Attribute Summary collapse
-
#categories_list ⇒ Object
Returns the value of attribute categories_list.
-
#currencies_list ⇒ Object
Returns the value of attribute currencies_list.
Instance Method Summary collapse
- #convert_currency(other_currency) ⇒ Object
-
#initialize(categories_list = nil, currencies_list = nil, offers = []) ⇒ OffersList
constructor
A new instance of OffersList.
- #prune_categories(level) ⇒ Object
Methods included from Container
Constructor Details
#initialize(categories_list = nil, currencies_list = nil, offers = []) ⇒ OffersList
Returns a new instance of OffersList.
7 8 9 10 11 12 13 |
# File 'lib/goods/offers_list.rb', line 7 def initialize(categories_list = nil, currencies_list = nil, offers = []) self.categories_list = categories_list self.currencies_list = currencies_list offers.each do |offer| add offer end end |
Instance Attribute Details
#categories_list ⇒ Object
Returns the value of attribute categories_list.
5 6 7 |
# File 'lib/goods/offers_list.rb', line 5 def categories_list @categories_list end |
#currencies_list ⇒ Object
Returns the value of attribute currencies_list.
5 6 7 |
# File 'lib/goods/offers_list.rb', line 5 def currencies_list @currencies_list end |
Instance Method Details
#convert_currency(other_currency) ⇒ Object
23 24 25 26 27 |
# File 'lib/goods/offers_list.rb', line 23 def convert_currency(other_currency) self.each do |offer| offer.convert_currency(other_currency) end end |
#prune_categories(level) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/goods/offers_list.rb', line 15 def prune_categories(level) self.each do |offer| if offer.category.level > level offer.change_category(offer.category.parent_at_level(level)) end end end |