Class: Redis::Commands::Search::AggregateResult
- Inherits:
-
Object
- Object
- Redis::Commands::Search::AggregateResult
- Includes:
- Enumerable
- Defined in:
- lib/redis/commands/modules/search/result.rb
Overview
Result of FT.AGGREGATE (and FT.CURSOR READ): the rows produced by the pipeline plus, when WITHCURSOR was requested, the cursor id to read the next batch with (0 when the cursor is exhausted).
Instance Attribute Summary collapse
- #cursor ⇒ Array<Hash{String => Object}>, ... readonly
- #rows ⇒ Array<Hash{String => Object}>, ... readonly
Instance Method Summary collapse
-
#[](index) ⇒ Hash?
The row at
index, or nil when out of range. -
#each {|row| ... } ⇒ Enumerator, Array<Hash>
Iterate over the rows.
-
#empty? ⇒ Boolean
Whether there are no rows.
-
#initialize(rows, cursor: nil) ⇒ AggregateResult
constructor
A new instance of AggregateResult.
-
#size ⇒ Integer
(also: #length)
The number of rows.
Constructor Details
#initialize(rows, cursor: nil) ⇒ AggregateResult
Returns a new instance of AggregateResult.
130 131 132 133 |
# File 'lib/redis/commands/modules/search/result.rb', line 130 def initialize(rows, cursor: nil) @rows = rows @cursor = cursor end |
Instance Attribute Details
#cursor ⇒ Array<Hash{String => Object}>, ... (readonly)
126 127 128 |
# File 'lib/redis/commands/modules/search/result.rb', line 126 def cursor @cursor end |
#rows ⇒ Array<Hash{String => Object}>, ... (readonly)
126 127 128 |
# File 'lib/redis/commands/modules/search/result.rb', line 126 def rows @rows end |
Instance Method Details
#[](index) ⇒ Hash?
Returns the row at index, or nil when out of range.
145 146 147 |
# File 'lib/redis/commands/modules/search/result.rb', line 145 def [](index) @rows[index] end |
#each {|row| ... } ⇒ Enumerator, Array<Hash>
Iterate over the rows.
139 140 141 |
# File 'lib/redis/commands/modules/search/result.rb', line 139 def each(&block) @rows.each(&block) end |
#empty? ⇒ Boolean
Returns whether there are no rows.
156 157 158 |
# File 'lib/redis/commands/modules/search/result.rb', line 156 def empty? @rows.empty? end |
#size ⇒ Integer Also known as: length
Returns the number of rows.
150 151 152 |
# File 'lib/redis/commands/modules/search/result.rb', line 150 def size @rows.size end |