Class: ConcurrentRails::Promises

Inherits:
Object
  • Object
show all
Extended by:
Testing::TestingFuture
Includes:
Concurrent::Promises::FactoryMethods, DelayAdapter, FutureAdapter
Defined in:
lib/concurrent_rails/promises.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Testing::TestingFuture

future

Methods included from FutureAdapter

#future_on_rails

Methods included from DelayAdapter

#delay_on_rails

Constructor Details

#initialize(executor) ⇒ Promises

Returns a new instance of Promises.



9
10
11
# File 'lib/concurrent_rails/promises.rb', line 9

def initialize(executor)
  @executor = executor
end

Instance Attribute Details

#executorObject (readonly)

Returns the value of attribute executor.



64
65
66
# File 'lib/concurrent_rails/promises.rb', line 64

def executor
  @executor
end

Instance Method Details

#touchObject



32
33
34
35
36
# File 'lib/concurrent_rails/promises.rb', line 32

def touch
  @instance = rails_wrapped { instance.touch }

  self
end

#wait(timeout = nil) ⇒ Object



38
39
40
41
42
# File 'lib/concurrent_rails/promises.rb', line 38

def wait(timeout = nil)
  result = permit_concurrent_loads { instance.__send__(:wait_until_resolved, timeout) }

  timeout ? result : self
end