Module: Trailblazer::Macro::Rescue
- Defined in:
- lib/trailblazer/macro/rescue.rb
Overview
TODO: remove me in 2.2.
Class Method Summary collapse
- .deprecate_positional_handler_signature(handler) ⇒ Object
-
.random_id ⇒ Object
TODO: for legacy reasons, we pass ‘:id` to #id_for.
Class Method Details
.deprecate_positional_handler_signature(handler) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/trailblazer/macro/rescue.rb', line 28 def self.deprecate_positional_handler_signature(handler) return handler if handler.is_a?(Symbol) # can't do nothing about this. return handler if handler.method(:call).arity != 2 # means (exception, (ctx, flow_options), *, &block), "new style" ->(exception, (ctx, ), **, &block) do warn "[Trailblazer] Rescue handlers have a new signature: (exception, *, &block)" handler.(exception, ctx, &block) end end |
.random_id ⇒ Object
TODO: for legacy reasons, we pass ‘:id` to #id_for. In 2.2, remove the id hint and use generic Trailblazer::Macro.id_for behavior.
40 41 42 |
# File 'lib/trailblazer/macro/rescue.rb', line 40 def self.random_id Macro.id_for(nil, macro: :Rescue, id: rand(1000)) end |