Class: SpreeCmCommissioner::Places::FindWithRoute

Inherits:
Object
  • Object
show all
Defined in:
app/finders/spree_cm_commissioner/places/find_with_route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keyword:, place_type:) ⇒ FindWithRoute

Returns a new instance of FindWithRoute.



21
22
23
24
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 21

def initialize(keyword:, place_type:)
  @keyword = keyword
  @place_type = place_type
end

Instance Attribute Details

#keywordObject (readonly)

Returns the value of attribute keyword.



19
20
21
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 19

def keyword
  @keyword
end

#place_typeObject (readonly)

Returns the value of attribute place_type.



19
20
21
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 19

def place_type
  @place_type
end

Instance Method Details

#executeObject



26
27
28
29
30
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 26

def execute
  return SpreeCmCommissioner::Place.none if keyword.blank? || place_type.blank?

  scope.where('cm_places.name ILIKE ?', "%#{keyword}%")
end