Module: Trailblazer::Operation::PublicCall
- Included in:
- Trailblazer::Operation
- Defined in:
- lib/trailblazer/operation/public_call.rb
Class Method Summary collapse
-
.options_for_public_call(options, **flow_options) ⇒ Object
Compile a Context object to be passed into the Activity::call.
Instance Method Summary collapse
-
#call(options = {}, *args) ⇒ Object
This is the outer-most public ‘call` method that gets invoked when calling `Create.()`.
-
#call_with_circuit_interface(args, circuit_options) ⇒ Object
This interface is used for all nested OPs (and the outer-most, too).
- #call_with_public_interface(*args) ⇒ Object
-
#flow_options ⇒ Object
@semi=public.
- #options_for_public_call(*args) ⇒ Object
Class Method Details
.options_for_public_call(options, **flow_options) ⇒ Object
Compile a Context object to be passed into the Activity::call.
49 50 51 |
# File 'lib/trailblazer/operation/public_call.rb', line 49 def self.(, **) Trailblazer::Context(, {}, [:context_options]) end |
Instance Method Details
#call(options = {}, *args) ⇒ Object
Do not override this method as it will be removed in future versions. Also, you will break tracing.
This is the outer-most public ‘call` method that gets invoked when calling `Create.()`. The signature of this is `params, options, *containers`. This was a mistake, as the first argument could’ve been part of ‘options` hash in the first place.
Create.(params, runtime_data, *containers)
#=> Result<Context...>
In workflows/Nested compositions, this method is not used anymore and it might probably get removed in future versions of TRB. Currently, we use Operation::__call__ as an alternative.
16 17 18 19 20 |
# File 'lib/trailblazer/operation/public_call.rb', line 16 def call( = {}, *args) return call_with_circuit_interface(, *args) if .is_a?(Array) # This is kind of a hack that could be well hidden if Ruby had method overloading. Goal is to simplify the call/__call__ thing as we're fading out Operation::call anyway. call_with_public_interface(, *args) end |
#call_with_circuit_interface(args, circuit_options) ⇒ Object
This interface is used for all nested OPs (and the outer-most, too).
39 40 41 |
# File 'lib/trailblazer/operation/public_call.rb', line 39 def call_with_circuit_interface(args, ) strategy_call(args, ) # FastTrack#call end |
#call_with_public_interface(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/trailblazer/operation/public_call.rb', line 22 def call_with_public_interface(*args) ctx = (*args, ()) # call the activity. # This will result in invoking {::call_with_circuit_interface}. # last_signal, (options, flow_options) = Activity::TaskWrap.invoke(self, [ctx, {}], {}) signal, (ctx, ) = Activity::TaskWrap.invoke( @activity, [ctx, ()], exec_context: new ) # Result is successful if the activity ended with an End event derived from Railway::End::Success. Operation::Railway::Result(signal, ctx, ) end |
#flow_options ⇒ Object
@semi=public
54 55 56 |
# File 'lib/trailblazer/operation/public_call.rb', line 54 def {} end |
#options_for_public_call(*args) ⇒ Object
43 44 45 |
# File 'lib/trailblazer/operation/public_call.rb', line 43 def (*args) Operation::PublicCall.(*args) end |