Class: Arrow::StructArray
- Inherits:
-
Object
- Object
- Arrow::StructArray
- Defined in:
- lib/arrow/struct-array.rb
Instance Method Summary collapse
- #fields ⇒ Object
- #fields_raw ⇒ Object
- #find_field(index_or_name) ⇒ Object
-
#get_value(i) ⇒ Hash
The ‘i`-th struct.
Instance Method Details
#fields ⇒ Object
55 56 57 |
# File 'lib/arrow/struct-array.rb', line 55 def fields @fields ||= fields_raw end |
#fields_raw ⇒ Object
54 |
# File 'lib/arrow/struct-array.rb', line 54 alias_method :fields_raw, :fields |
#find_field(index) ⇒ Arrow::Array? #find_field(name) ⇒ Arrow::Array?
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/arrow/struct-array.rb', line 43 def find_field(index_or_name) case index_or_name when String, Symbol name = index_or_name (@name_to_field ||= build_name_to_field)[name.to_s] else index = index_or_name fields[index] end end |
#get_value(i) ⇒ Hash
Returns The ‘i`-th struct.
26 27 28 29 30 31 32 |
# File 'lib/arrow/struct-array.rb', line 26 def get_value(i) value = {} value_data_type.fields.zip(fields) do |field, field_array| value[field.name] = field_array[i] end value end |