Class: Groonga::SubRecords
- Inherits:
-
Object
- Object
- Groonga::SubRecords
- Includes:
- Enumerable
- Defined in:
- lib/groonga/sub-records.rb
Overview
Represents sub records of a Record. Grouped result set by Table#group only has sub records.
SubRecords acts like an ::Array.
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
The record that has this sub records.
Instance Method Summary collapse
-
#[](index) ⇒ Record
A sub record at index.
-
#each {|record| ... } ⇒ void
-
#initialize(record) ⇒ SubRecords
constructor
Creates a sub records container for the record.
-
#to_a ⇒ Array<Record>
(also: #to_ary)
Sub records as ::Array.
Constructor Details
#initialize(record) ⇒ SubRecords
Creates a sub records container for the record.
Normally, users don’t need to instantiate Groonga::SubRecords directly. Record#sub_records creates and returns a Groonga::SubRecords.
36 37 38 |
# File 'lib/groonga/sub-records.rb', line 36 def initialize(record) @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
The record that has this sub records.
27 28 29 |
# File 'lib/groonga/sub-records.rb', line 27 def record @record end |
Instance Method Details
#[](index) ⇒ Record
Returns A sub record at index.
57 58 59 |
# File 'lib/groonga/sub-records.rb', line 57 def [](index) to_a[index] end |
#each {|record| ... } ⇒ void
This method returns an undefined value.
43 44 45 |
# File 'lib/groonga/sub-records.rb', line 43 def each(&block) @record.table.each_sub_record(@record.record_raw_id, &block) end |