Class: ConcurrentRails::Promises
- Inherits:
-
Object
- Object
- ConcurrentRails::Promises
- Extended by:
- Testing::TestingFuture
- Includes:
- Concurrent::Promises::FactoryMethods, DelayAdapter, FutureAdapter
- Defined in:
- lib/concurrent_rails/promises.rb
Instance Attribute Summary collapse
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
Instance Method Summary collapse
-
#initialize(executor) ⇒ Promises
constructor
A new instance of Promises.
- #touch ⇒ Object
- #wait(timeout = nil) ⇒ Object
Methods included from Testing::TestingFuture
Methods included from FutureAdapter
Methods included from DelayAdapter
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
#executor ⇒ Object (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
#touch ⇒ Object
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 |