class Concurrent::Edge::ScheduledPromise

will be evaluated to task in #intended_time @!visibility private

Public Class Methods

new(default_executor, intended_time) click to toggle source
Calls superclass method Concurrent::Edge::AbstractPromise.new
# File lib/concurrent/edge/future.rb, line 1400
def initialize(default_executor, intended_time)
  super Event.new(self, default_executor)

  @IntendedTime = intended_time

  in_seconds = begin
    now           = Time.now
    schedule_time = if @IntendedTime.is_a? Time
                      @IntendedTime
                    else
                      now + @IntendedTime
                    end
    [0, schedule_time.to_f - now.to_f].max
  end

  Concurrent.global_timer_set.post(in_seconds) do
    @Future.complete_with Event::COMPLETED
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/concurrent/edge/future.rb, line 1394
def inspect
  "#{to_s[0..-2]} intended_time:[#{@IntendedTime}}>"
end
intended_time() click to toggle source
# File lib/concurrent/edge/future.rb, line 1390
def intended_time
  @IntendedTime
end