Sha256: 9bc00086e5ec7c517da9b4680f9cd63f391a48527dc1b0f40e471d06ad990759
Contents?: true
Size: 655 Bytes
Versions: 2
Compression:
Stored size: 655 Bytes
Contents
# frozen_string_literal: true require "dry/effects/effect" module Dry module Effects module Effects class Timeout < ::Module class TimeoutEffect < Effect include ::Dry::Equalizer(:type, :name, :scope) option :scope end def initialize(scope) super() timeout = TimeoutEffect.new(type: :timeout, name: :timeout, scope: scope) module_eval do define_method(:timeout) do ::Dry::Effects.yield(timeout) end def timed_out? timeout.zero? end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-effects-0.3.0 | lib/dry/effects/effects/timeout.rb |
dry-effects-0.2.0 | lib/dry/effects/effects/timeout.rb |