Class: Spree::Stores::FindCurrent

Inherits:
Object
  • Object
show all
Defined in:
app/finders/spree/stores/find_current.rb

Instance Method Summary collapse

Constructor Details

#initialize(scope: nil, url: nil) ⇒ FindCurrent

Returns a new instance of FindCurrent.



4
5
6
7
# File 'app/finders/spree/stores/find_current.rb', line 4

def initialize(scope: nil, url: nil)
  @scope = scope || Spree::Store
  @url = url
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
# File 'app/finders/spree/stores/find_current.rb', line 9

def execute
  store = by_url(scope) || scope.default
  return if store.nil?

  Spree::Current.store = store
  store
end