Class: Dry::Effects::Providers::Interrupt

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/effects/providers/interrupt.rb

Instance Method Summary collapse

Instance Method Details

#callObject

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

API:

  • private



14
15
16
17
18
# File 'lib/dry/effects/providers/interrupt.rb', line 14

def call
  [false, yield]
rescue halt => e
  [true, e.payload[0]]
end

#haltObject



20
# File 'lib/dry/effects/providers/interrupt.rb', line 20

def halt = Halt[scope]

#interrupt(*payload) ⇒ Object



9
# File 'lib/dry/effects/providers/interrupt.rb', line 9

def interrupt(*payload) = Instructions.Raise(halt.new(payload))

#provide?(effect) ⇒ Boolean

Parameters:

Returns:

API:

  • public



29
# File 'lib/dry/effects/providers/interrupt.rb', line 29

def provide?(effect) = super && scope.equal?(effect.scope)

#representString

Returns:

API:

  • public



24
# File 'lib/dry/effects/providers/interrupt.rb', line 24

def represent = "interrupt[#{scope}]"