Module: Easyop::Flow::ClassMethods
- Defined in:
- lib/easyop/flow.rb
Instance Method Summary collapse
- #_flow_steps ⇒ Object
-
#flow(*steps) ⇒ Object
Declare the ordered list of operation classes (and optional guards).
-
#prepare ⇒ Object
Returns a FlowBuilder for pre-registering callbacks before .call.
Instance Method Details
#_flow_steps ⇒ Object
74 75 76 |
# File 'lib/easyop/flow.rb', line 74 def _flow_steps @_flow_steps ||= [] end |
#flow(*steps) ⇒ Object
Declare the ordered list of operation classes (and optional guards).
70 71 72 |
# File 'lib/easyop/flow.rb', line 70 def flow(*steps) @_flow_steps = steps.flatten end |
#prepare ⇒ Object
Returns a FlowBuilder for pre-registering callbacks before .call.
ProcessCheckout.prepare
.on_success { |ctx| redirect_to order_path(ctx.order) }
.on_failure { |ctx| flash[:error] = ctx.error }
.call(user: current_user, cart: current_cart)
ProcessCheckout.prepare
.bind_with(self)
.on(success: :order_placed, fail: :show_errors)
.call(user: current_user, cart: current_cart)
89 90 91 |
# File 'lib/easyop/flow.rb', line 89 def prepare FlowBuilder.new(self) end |