Class: SpreeCmCommissioner::Places::FindWithRoute
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Places::FindWithRoute
- Defined in:
- app/finders/spree_cm_commissioner/places/find_with_route.rb
Instance Attribute Summary collapse
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#place_id ⇒ Object
readonly
Returns the value of attribute place_id.
-
#place_type ⇒ Object
readonly
Returns the value of attribute place_type.
-
#route_type ⇒ Object
readonly
Returns the value of attribute route_type.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(place_type:, place_id: nil, keyword: nil, route_type: nil) ⇒ FindWithRoute
constructor
A new instance of FindWithRoute.
Constructor Details
#initialize(place_type:, place_id: nil, keyword: nil, route_type: nil) ⇒ FindWithRoute
Returns a new instance of FindWithRoute.
27 28 29 30 31 32 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 27 def initialize(place_type:, place_id: nil, keyword: nil, route_type: nil) @place_type = place_type @place_id = place_id @keyword = keyword @route_type = route_type end |
Instance Attribute Details
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
25 26 27 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 25 def keyword @keyword end |
#place_id ⇒ Object (readonly)
Returns the value of attribute place_id.
25 26 27 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 25 def place_id @place_id end |
#place_type ⇒ Object (readonly)
Returns the value of attribute place_type.
25 26 27 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 25 def place_type @place_type end |
#route_type ⇒ Object (readonly)
Returns the value of attribute route_type.
25 26 27 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 25 def route_type @route_type end |
Instance Method Details
#execute ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 34 def execute return SpreeCmCommissioner::Place.none if place_type.blank? return SpreeCmCommissioner::Place.none if place_id.present? && !SpreeCmCommissioner::Place.exists?(place_id) result = scope result = apply_keyword_filter(result) if keyword.present? result = apply_route_type_filter(result) if route_type.present? result end |