Class: Arrow::StructArray

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/struct-array.rb

Instance Method Summary collapse

Instance Method Details

#[](i) ⇒ Object



22
23
24
25
26
27
# File 'lib/arrow/struct-array.rb', line 22

def [](i)
  warn("Use #{self.class}\#find_field instead. " +
       "This will returns Arrow::Struct instead of Arrow::Array " +
       "since 0.13.0.")
  get_field(i)
end

#find_field(index_or_name) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/arrow/struct-array.rb', line 33

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
    cached_fields[index]
  end
end

#get_value(i) ⇒ Object



29
30
31
# File 'lib/arrow/struct-array.rb', line 29

def get_value(i)
  Struct.new(self, i)
end