Class: Spree::Stock::ShippingRateSorter
- Inherits:
-
Object
- Object
- Spree::Stock::ShippingRateSorter
- Defined in:
- app/models/spree/stock/shipping_rate_sorter.rb
Instance Attribute Summary collapse
-
#shipping_rates ⇒ Object
readonly
Returns the value of attribute shipping_rates.
Instance Method Summary collapse
-
#initialize(shipping_rates) ⇒ ShippingRateSorter
constructor
A new instance of ShippingRateSorter.
- #sort ⇒ Object
Constructor Details
#initialize(shipping_rates) ⇒ ShippingRateSorter
Returns a new instance of ShippingRateSorter.
8 9 10 |
# File 'app/models/spree/stock/shipping_rate_sorter.rb', line 8 def initialize(shipping_rates) @shipping_rates = shipping_rates end |
Instance Attribute Details
#shipping_rates ⇒ Object (readonly)
Returns the value of attribute shipping_rates.
6 7 8 |
# File 'app/models/spree/stock/shipping_rate_sorter.rb', line 6 def shipping_rates @shipping_rates end |
Instance Method Details
#sort ⇒ Object
12 13 14 |
# File 'app/models/spree/stock/shipping_rate_sorter.rb', line 12 def sort shipping_rates.sort_by(&:cost) end |