Module: Trailblazer::Operation::Trace
- Included in:
- Trailblazer::Operation
- Defined in:
- lib/trailblazer/operation/trace.rb
Defined Under Namespace
Classes: Result
Class Method Summary collapse
- .call(operation, options) ⇒ Object
-
.find_caller_location_for_deprecated ⇒ Object
TODO: remove in 0.11.0.
Instance Method Summary collapse
-
#trace(options) ⇒ Object
‘Operation::trace` is included for simple tracing of the flow.
- #wtf?(options) ⇒ Boolean
Class Method Details
.call(operation, options) ⇒ Object
Note:
The problem in this method is, we have redundancy with Operation::PublicCall
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/trailblazer/operation/trace.rb', line 8 def self.call(operation, ) # warn %{Trailblazer: `Operation.trace` is deprecated. Please use `Operation.wtf?`.} # DISCUSS: should this be deprecated? ctx = PublicCall.() # redundant with PublicCall::call. stack, signal, (ctx, ) = Developer::Trace.(operation, [ctx, {}]) result = Railway::Result(signal, ctx) # redundant with PublicCall::call. Result.new(result, stack) end |
.find_caller_location_for_deprecated ⇒ Object
TODO: remove in 0.11.0.
38 39 40 41 42 43 |
# File 'lib/trailblazer/operation/trace.rb', line 38 def self.find_caller_location_for_deprecated our_caller_locations = caller_locations.to_a caller_location = our_caller_locations.reverse.find { |line| line.to_s =~ /operation\/trace/ } _caller_location = our_caller_locations[our_caller_locations.index(caller_location)+1] end |
Instance Method Details
#trace(options) ⇒ Object
‘Operation::trace` is included for simple tracing of the flow. It simply forwards all arguments to `Trace.call`.
TODO: remove in 0.11.0.
26 27 28 29 30 31 |
# File 'lib/trailblazer/operation/trace.rb', line 26 def trace() Activity::Deprecate.warn Trace.find_caller_location_for_deprecated, %(Using `Operation.trace` is deprecated and will be removed in {trailblazer-operation-0.11.0}. Please use `#{self}.wtf?` as documented here: https://trailblazer.to/2.1/docs/trailblazer#trailblazer-developer-wtf-) Trace.(self, ) end |
#wtf?(options) ⇒ Boolean
33 34 35 |
# File 'lib/trailblazer/operation/trace.rb', line 33 def wtf?() call_with_public_interface(, {}, invoke_class: Developer::Wtf) end |