Class: Spree::Stock::ShippingRateSelector Private

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/stock/shipping_rate_selector.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shipping_rates) ⇒ ShippingRateSelector

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ShippingRateSelector



6
7
8
# File 'app/models/spree/stock/shipping_rate_selector.rb', line 6

def initialize(shipping_rates)
  @shipping_rates = shipping_rates
end

Instance Attribute Details

#shipping_ratesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'app/models/spree/stock/shipping_rate_selector.rb', line 4

def shipping_rates
  @shipping_rates
end

Instance Method Details

#find_defaultObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'app/models/spree/stock/shipping_rate_selector.rb', line 10

def find_default
  shipping_rates.min_by(&:cost)
end