Class: Nanoarrow::ArrayStream
- Inherits:
-
Object
- Object
- Nanoarrow::ArrayStream
- Defined in:
- lib/nanoarrow/array_stream.rb
Instance Method Summary collapse
- #arrow_c_stream ⇒ Object
- #each ⇒ Object
-
#initialize(obj, schema = nil) ⇒ ArrayStream
constructor
A new instance of ArrayStream.
- #read_all ⇒ Object
- #read_next ⇒ Object
- #schema ⇒ Object
Constructor Details
#initialize(obj, schema = nil) ⇒ ArrayStream
Returns a new instance of ArrayStream.
3 4 5 |
# File 'lib/nanoarrow/array_stream.rb', line 3 def initialize(obj, schema = nil) @c_array_stream = Utils.c_array_stream(obj, schema) end |
Instance Method Details
#arrow_c_stream ⇒ Object
11 12 13 |
# File 'lib/nanoarrow/array_stream.rb', line 11 def arrow_c_stream @c_array_stream.arrow_c_stream end |
#each ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/nanoarrow/array_stream.rb', line 24 def each return to_enum(:each) unless block_given? while (c_array = @c_array_stream.get_next) yield Array.new(CMaterializedArrayStream.from_c_array(c_array)) end end |
#read_all ⇒ Object
15 16 17 |
# File 'lib/nanoarrow/array_stream.rb', line 15 def read_all Array.new(@c_array_stream) end |
#read_next ⇒ Object
19 20 21 22 |
# File 'lib/nanoarrow/array_stream.rb', line 19 def read_next c_array = @c_array_stream.get_next Array.new(CMaterializedArrayStream.from_c_array(c_array)) if c_array end |