Class: Spree::Pricing::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/pricing/resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Resolver

Initializes the resolver

Parameters:



8
9
10
# File 'lib/spree/core/pricing/resolver.rb', line 8

def initialize(context)
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/spree/core/pricing/resolver.rb', line 4

def context
  @context
end

Instance Method Details

#resolveSpree::Price

Returns the best price for the variant

Returns:



14
15
16
17
18
# File 'lib/spree/core/pricing/resolver.rb', line 14

def resolve
  Rails.cache.fetch(cache_key, expires_in: 15.minutes) do
    find_best_price
  end
end