Class: Dry::Effects::Providers::Interrupt
- Inherits:
-
Object
- Object
- Dry::Effects::Providers::Interrupt
- Defined in:
- lib/dry/effects/providers/interrupt.rb
Instance Method Summary collapse
-
#call ⇒ Object
private
Yield the block with the handler installed.
- #halt ⇒ Object
- #interrupt(*payload) ⇒ Object
- #provide?(effect) ⇒ Boolean
- #represent ⇒ String
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Yield the block with the handler installed
16 17 18 19 20 |
# File 'lib/dry/effects/providers/interrupt.rb', line 16 def call [false, yield] rescue halt => e [true, e.payload[0]] end |
#halt ⇒ Object
22 23 24 |
# File 'lib/dry/effects/providers/interrupt.rb', line 22 def halt Halt[scope] end |
#interrupt(*payload) ⇒ Object
9 10 11 |
# File 'lib/dry/effects/providers/interrupt.rb', line 9 def interrupt(*payload) Instructions.Raise(halt.new(payload)) end |
#provide?(effect) ⇒ Boolean
35 36 37 |
# File 'lib/dry/effects/providers/interrupt.rb', line 35 def provide?(effect) super && scope.equal?(effect.scope) end |
#represent ⇒ String
28 29 30 |
# File 'lib/dry/effects/providers/interrupt.rb', line 28 def represent "interrupt[#{scope}]" end |