Sha256: 38408a60263de0e3d27ae8430254a1819423a0fd70033fc0e043a629bbfb8fae
Contents?: true
Size: 749 Bytes
Versions: 1
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true module Dry module Effects module Providers class Interrupt < Provider[:interrupt] param :scope, default: -> { :default } def interrupt(*payload) = Instructions.Raise(halt.new(payload)) # Yield the block with the handler installed # # @api private def call [false, yield] rescue halt => e [true, e.payload[0]] end def halt = Halt[scope] # @return [String] # @api public def represent = "interrupt[#{scope}]" # @param [Effect] effect # @return [Boolean] # @api public def provide?(effect) = super && scope.equal?(effect.scope) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-effects-0.5.0 | lib/dry/effects/providers/interrupt.rb |