Class: Spree::Pricing::Resolver
- Inherits:
-
Object
- Object
- Spree::Pricing::Resolver
- Defined in:
- lib/spree/core/pricing/resolver.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context) ⇒ Resolver
constructor
Initializes the resolver.
-
#resolve ⇒ Spree::Price
Returns the best price for the variant.
Constructor Details
#initialize(context) ⇒ Resolver
Initializes the resolver
8 9 10 |
# File 'lib/spree/core/pricing/resolver.rb', line 8 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (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
#resolve ⇒ Spree::Price
Returns the best price for the variant
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 |