30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/arrow/column-containable.rb', line 30
def find_column(name_or_index)
case name_or_index
when String, Symbol
name = name_or_index.to_s
index = schema.get_field_index(name)
return nil if index == -1
Column.new(self, index)
when Integer
index = name_or_index
index += n_columns if index < 0
return nil if index < 0 or index >= n_columns
Column.new(self, index)
else
message = "column name or index must be String, Symbol or Integer"
raise ArgumentError, message
end
end
|