Class: Spree::Products::Find
- Inherits:
-
Object
- Object
- Spree::Products::Find
- Defined in:
- app/finders/spree/products/find.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(scope:, params:, current_currency:) ⇒ Find
constructor
A new instance of Find.
Constructor Details
#initialize(scope:, params:, current_currency:) ⇒ Find
Returns a new instance of Find.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/finders/spree/products/find.rb', line 4 def initialize(scope:, params:, current_currency:) @scope = scope @ids = String(params.dig(:filter, :ids)).split(',') @skus = String(params.dig(:filter, :skus)).split(',') @price = String(params.dig(:filter, :price)).split(',') @currency = params[:currency] || current_currency @taxons = String(params.dig(:filter, :taxons)).split(',') @name = params.dig(:filter, :name) @options = params.dig(:filter, :options).try(:to_unsafe_hash) end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/finders/spree/products/find.rb', line 16 def execute products = by_ids(scope) products = by_skus(products) products = by_price(products) products = by_taxons(products) products = by_name(products) products = (products) products end |