Class: Spree::Core::Search::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/search/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
# File 'lib/spree/core/search/base.rb', line 7

def initialize(params)
  @properties = {}
  @current_store = params[:current_store] || Spree::Store.default
  @current_currency = @current_store.default_currency
  @taxon = params[:taxon]

  prepare(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/spree/core/search/base.rb', line 20

def method_missing(name)
  if @properties.key? name
    @properties[name]
  else
    super
  end
end

Instance Attribute Details

#current_currencyObject

Returns the value of attribute current_currency.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def current_currency
  @current_currency
end

#current_storeObject

Returns the value of attribute current_store.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def current_store
  @current_store
end

#current_userObject

Returns the value of attribute current_user.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def current_user
  @current_user
end

#propertiesObject

Returns the value of attribute properties.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def properties
  @properties
end

#taxonObject

Returns the value of attribute taxon.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def taxon
  @taxon
end

Instance Method Details

#retrieve_productsObject



16
17
18
# File 'lib/spree/core/search/base.rb', line 16

def retrieve_products
  @products = extended_base_scope.page(page || 1).per(per_page)
end