class Dry::Effects::Effects::Timeout

Public Class Methods

new(scope) click to toggle source
Calls superclass method
# File lib/dry/effects/effects/timeout.rb, line 15
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

Public Instance Methods

timed_out?() click to toggle source
# File lib/dry/effects/effects/timeout.rb, line 25
def timed_out?
  timeout.zero?
end