Class: Actor::Future
- Inherits:
-
Object
- Object
- Actor::Future
- Defined in:
- lib/actor/future.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
Class Method Summary collapse
Instance Method Summary collapse
- #get(wait: nil) ⇒ Object
-
#initialize(reader) ⇒ Future
constructor
A new instance of Future.
- #ready? ⇒ Boolean
Constructor Details
#initialize(reader) ⇒ Future
Returns a new instance of Future.
6 7 8 |
# File 'lib/actor/future.rb', line 6 def initialize reader @reader = reader end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/actor/future.rb', line 4 def end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader.
3 4 5 |
# File 'lib/actor/future.rb', line 3 def reader @reader end |
Class Method Details
.build(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/actor/future.rb', line 10 def self.build &block address = Address.build reader = Messaging::Read.build address instance = new reader block.(address) instance end |
.get(wait: nil, &block) ⇒ Object
21 22 23 24 |
# File 'lib/actor/future.rb', line 21 def self.get wait: nil, &block instance = build &block instance.get wait: wait end |
Instance Method Details
#get(wait: nil) ⇒ Object
26 27 28 29 30 |
# File 'lib/actor/future.rb', line 26 def get wait: nil return unless .nil? self. = reader.(wait: wait) end |
#ready? ⇒ Boolean
32 33 34 35 36 |
# File 'lib/actor/future.rb', line 32 def ready? get ? true : false end |