class Obligation::Value

Public Class Methods

new() click to toggle source
Calls superclass method Obligation::Base::new
# File lib/obligation/impl.rb, line 82
def initialize
  super

  @result = nil
end

Protected Instance Methods

_value(timeout) click to toggle source
# File lib/obligation/impl.rb, line 90
def _value(timeout)
  @event.wait(timeout) if pending? && timeout != 0
  @mutex.synchronize do
    case @state
      when :fulfilled then @result
      when :rejected  then raise RejectedError.new \
        "Obligation rejected due to #{@reason}.", @reason
      else raise TimeoutError.new
    end
  end
end