Module: Arrow::ListValuesAppendable
- Included in:
- FixedSizeListArrayBuilder, LargeListArrayBuilder, ListArrayBuilder
- Defined in:
- lib/arrow/list-values-appendable.rb
Instance Method Summary collapse
- #append(*values) ⇒ Object
- #append_value(*args) ⇒ Object
- #append_values(lists, is_valids = nil) ⇒ Object
Instance Method Details
#append(*values) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/arrow/list-values-appendable.rb', line 79 def append(*values) if values.empty? # For backward compatibility append_value else super end end |
#append_value ⇒ Object #append_value(list) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/arrow/list-values-appendable.rb', line 36 def append_value(*args) n_args = args.size case n_args when 0 super() when 1 value = args[0] case value when nil append_null when ::Array super() return if value.empty? @value_builder ||= value_builder @value_builder.append(*value) else = "list value must be nil or Array: #{value.inspect}" raise ArgumentError, end else = "wrong number of arguments (given #{n_args}, expected 0..1)" raise ArgumentError, end end |
#append_values(lists, is_valids = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/arrow/list-values-appendable.rb', line 62 def append_values(lists, is_valids=nil) if is_valids is_valids.each_with_index do |is_valid, i| if is_valid append_value(lists[i]) else append_null end end else lists.each do |list| append_value(list) end end end |