Module: Arrow::RecordContainable

Included in:
RecordBatch, Table
Defined in:
lib/arrow/record-containable.rb

Instance Method Summary collapse

Instance Method Details

#each_record(reuse_record: false) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/arrow/record-containable.rb', line 20

def each_record(reuse_record: false)
  unless block_given?
    return to_enum(__method__, reuse_record: reuse_record)
  end

  if reuse_record
    record = Record.new(self, nil)
    n_rows.times do |i|
      record.index = i
      yield(record)
    end
  else
    n_rows.times do |i|
      yield(Record.new(self, i))
    end
  end
end