Class: Estore::Commands::Promise

Inherits:
Promise
  • Object
show all
Defined in:
lib/estore/commands/promise.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(correlation_id) ⇒ Promise

Returns a new instance of Promise.



6
7
8
9
# File 'lib/estore/commands/promise.rb', line 6

def initialize(correlation_id)
  super()
  @correlation_id = correlation_id
end

Instance Attribute Details

#correlation_idObject (readonly)

Returns the value of attribute correlation_id.



4
5
6
# File 'lib/estore/commands/promise.rb', line 4

def correlation_id
  @correlation_id
end

Instance Method Details

#waitObject



11
12
13
14
15
16
# File 'lib/estore/commands/promise.rb', line 11

def wait
  t = Thread.current
  resume = proc { t.wakeup }
  self.then(resume, resume)
  sleep
end