Class: Spree::Taxons::Find

Inherits:
Object
  • Object
show all
Defined in:
app/finders/spree/taxons/find.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope:, params:) ⇒ Find

Returns a new instance of Find.



4
5
6
7
8
9
10
11
12
# File 'app/finders/spree/taxons/find.rb', line 4

def initialize(scope:, params:)
  @scope = scope

  @ids      = String(params[:ids]).split(',')
  @parent   = params[:parent_id]
  @taxonomy = params[:taxonomy_id]
  @name     = params[:name]
  @roots    = params[:roots]
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
# File 'app/finders/spree/taxons/find.rb', line 14

def execute
  taxons = by_ids(scope)
  taxons = by_parent(taxons)
  taxons = by_taxonomy(taxons)
  taxons = by_roots(taxons)
  taxons = by_name(taxons)

  taxons
end