Class: ArrowFormat::BooleanArray

Inherits:
PrimitiveArray show all
Defined in:
lib/arrow-format/array.rb

Instance Attribute Summary

Attributes inherited from Array

#offset, #size, #type, #validity_buffer

Instance Method Summary collapse

Methods inherited from Array

#empty?, #n_nulls, #null?, #slice, #valid?

Constructor Details

#initialize(size, validity_buffer, values_buffer) ⇒ BooleanArray

Returns a new instance of BooleanArray.



189
190
191
# File 'lib/arrow-format/array.rb', line 189

def initialize(size, validity_buffer, values_buffer)
  super(BooleanType.singleton, size, validity_buffer, values_buffer)
end

Instance Method Details

#each_buffer {|slice_bitmap_buffer(:validity, @validity_buffer)| ... } ⇒ Object

Yields:



201
202
203
204
205
206
# File 'lib/arrow-format/array.rb', line 201

def each_buffer
  return to_enum(__method__) unless block_given?

  yield(slice_bitmap_buffer(:validity, @validity_buffer))
  yield(slice_bitmap_buffer(:values, @values_buffer))
end

#to_aObject



193
194
195
196
197
198
199
# File 'lib/arrow-format/array.rb', line 193

def to_a
  return [] if empty?

  @values_bitmap ||= Bitmap.new(@values_buffer, @offset, @size)
  values = @values_bitmap.to_a
  apply_validity(values)
end