Class: Nanoarrow::ArrayFromIterableBuilder
- Inherits:
-
ArrayBuilder
- Object
- ArrayBuilder
- Nanoarrow::ArrayFromIterableBuilder
- Defined in:
- lib/nanoarrow/array_builder.rb
Instance Method Summary collapse
- #append(obj) ⇒ Object
- #finish_building ⇒ Object
-
#initialize(schema) ⇒ ArrayFromIterableBuilder
constructor
A new instance of ArrayFromIterableBuilder.
- #start_building ⇒ Object
Methods inherited from ArrayBuilder
Constructor Details
#initialize(schema) ⇒ ArrayFromIterableBuilder
Returns a new instance of ArrayFromIterableBuilder.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nanoarrow/array_builder.rb', line 18 def initialize(schema) super(schema) type_id = @schema_view.type_id if !ARRAY_BUILDER_FROM_ITERABLE_METHOD.include?(type_id) raise ArgumentError, "Can't build array of type #{@schema_view.type} from iterable" end method_name = ARRAY_BUILDER_FROM_ITERABLE_METHOD.fetch(type_id) @append_impl = method(method_name) end |
Instance Method Details
#append(obj) ⇒ Object
34 35 36 |
# File 'lib/nanoarrow/array_builder.rb', line 34 def append(obj) @append_impl.(obj) end |
#finish_building ⇒ Object
38 39 40 |
# File 'lib/nanoarrow/array_builder.rb', line 38 def finish_building @c_builder.finish end |
#start_building ⇒ Object
30 31 32 |
# File 'lib/nanoarrow/array_builder.rb', line 30 def start_building @c_builder.start_appending end |