Class: SolidusPromotions::PromotionLane
- Inherits:
-
ActiveSupport::CurrentAttributes
- Object
- ActiveSupport::CurrentAttributes
- SolidusPromotions::PromotionLane
- Defined in:
- app/models/solidus_promotions/promotion_lane.rb
Overview
PromotionLane is a thread-safe current attributes class that manages the current promotion lane context.
This class extends ActiveSupport::CurrentAttributes to provide thread-local storage for the current promotion lane. It allows setting and retrieving the current lane, as well as getting all lanes that come before the current one.
Instance Method Summary collapse
- #current_lane=(arg) ⇒ Object
-
#previous_lanes ⇒ Array<String>
Retrieves the lanes that occur before the current lane in the promotion flow.
Instance Method Details
#current_lane=(arg) ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/models/solidus_promotions/promotion_lane.rb', line 22 def current_lane=(arg) if arg.present? super(arg.to_s) else super end end |
#previous_lanes ⇒ Array<String>
Retrieves the lanes that occur before the current lane in the promotion flow.
Delegates to ‘before(current_lane)` to compute the preceding lanes.
Special considerations:
-
If ‘current_lane` is `nil`, all lanes are returned.
38 39 40 |
# File 'app/models/solidus_promotions/promotion_lane.rb', line 38 def previous_lanes before(current_lane) end |