Class: Workarea::Search::StorefrontSearch::ProductMultipass
- Inherits:
-
Object
- Object
- Workarea::Search::StorefrontSearch::ProductMultipass
- Includes:
- Middleware
- Defined in:
- app/queries/workarea/search/storefront_search/product_multipass.rb
Instance Method Summary collapse
Methods included from Middleware
Instance Method Details
#call(response, &traverse_chain) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/queries/workarea/search/storefront_search/product_multipass.rb', line 19 def call(response, &traverse_chain) current_pass = response.query.response if sufficient_results?(current_pass) yield else pass_params = params.merge(pass: next_pass) new_pass = self.class.new(pass_params, customization) response.reset!(pass_params, by: self) new_pass.call(response, &traverse_chain) end end |
#last_pass? ⇒ Boolean
7 8 9 |
# File 'app/queries/workarea/search/storefront_search/product_multipass.rb', line 7 def last_pass? params[:pass] == ProductSearch::PASSES.last end |
#next_pass ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/queries/workarea/search/storefront_search/product_multipass.rb', line 11 def next_pass if params[:pass].blank? ProductSearch::PASSES.second else ProductSearch::PASSES.last end end |