Sha256: 92a6a3279062fc7a5261d37d7098411e1440c82418de9e7ba6ff3e095c4f13a5
Contents?: true
Size: 679 Bytes
Versions: 2
Compression:
Stored size: 679 Bytes
Contents
# frozen_string_literal: true require 'dry/effects/effect' module Dry module Effects module Effects class Interrupt < ::Module class InterruptEffect < Effect option :scope end def initialize(scope = :default) interrupt = InterruptEffect.new(type: :interrupt, scope: scope) module_eval do define_method(scope) do |payload = Undefined| if Undefined.equal?(payload) ::Dry::Effects.yield(interrupt) else ::Dry::Effects.yield(interrupt.payload(payload)) end end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-effects-0.1.5 | lib/dry/effects/effects/interrupt.rb |
dry-effects-0.1.4 | lib/dry/effects/effects/interrupt.rb |