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
# File 'app/finders/spree/taxons/find.rb', line 4

def initialize(scope:, params:)
  @scope = scope
  @ids      = String(params.dig(:filter, :ids)).split(',')
  @parent   = params.dig(:filter, :parent_id)
  @taxonomy = params.dig(:filter, :taxonomy_id)
  @name     = params.dig(:filter, :name)
  @roots    = params.dig(:filter, :roots)
end

Instance Method Details

#executeObject



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

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

  taxons
end