Class: Estore::Commands::ReadBatch
- Inherits:
-
Object
- Object
- Estore::Commands::ReadBatch
- Includes:
- Command, ReadStreamForward
- Defined in:
- lib/estore/commands/reads/batch.rb
Instance Attribute Summary
Attributes included from Command
Instance Method Summary collapse
- #call ⇒ Object
- #completed(response) ⇒ Object
-
#initialize(connection, stream, from, limit) ⇒ ReadBatch
constructor
A new instance of ReadBatch.
Methods included from ReadStreamForward
Methods included from Command
#handle, #promise, #register!, #reject!, #remove!, #write
Constructor Details
#initialize(connection, stream, from, limit) ⇒ ReadBatch
Returns a new instance of ReadBatch.
9 10 11 12 |
# File 'lib/estore/commands/reads/batch.rb', line 9 def initialize(connection, stream, from, limit) super(connection) @stream, @from, @limit = stream, from, limit end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 |
# File 'lib/estore/commands/reads/batch.rb', line 14 def call register! read(@stream, @from, @limit) promise end |
#completed(response) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/estore/commands/reads/batch.rb', line 20 def completed(response) remove! error = error(response) if error promise.reject error else promise.fulfill(Array(response.events)) end end |