Class: Workarea::Search::ProductEntries
- Inherits:
-
Object
- Object
- Workarea::Search::ProductEntries
- Includes:
- Enumerable
- Defined in:
- app/queries/workarea/search/product_entries.rb
Overview
This class exists to provide plugins and host applications a single point of modification for changing the logic around indexing products See workarea-browse_option or workarea-package_products for example.
Instance Method Summary collapse
- #entries ⇒ Object
- #index_entries_for(product) ⇒ Object
-
#initialize(products) ⇒ ProductEntries
constructor
A new instance of ProductEntries.
Constructor Details
#initialize(products) ⇒ ProductEntries
11 12 13 |
# File 'app/queries/workarea/search/product_entries.rb', line 11 def initialize(products) @products = Array.wrap(products) end |
Instance Method Details
#entries ⇒ Object
15 16 17 |
# File 'app/queries/workarea/search/product_entries.rb', line 15 def entries @entries ||= @products.flat_map { |p| index_entries_for(p) } end |
#index_entries_for(product) ⇒ Object
19 20 21 |
# File 'app/queries/workarea/search/product_entries.rb', line 19 def index_entries_for(product) Search::Storefront::Product.new(product) end |