Class: Parqueteur::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/parqueteur/struct.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Struct

Returns a new instance of Struct.



5
6
7
# File 'lib/parqueteur/struct.rb', line 5

def initialize(&block)
  instance_exec(&block)
end

Instance Method Details

#field(name, type, options = {}, &block) ⇒ Object



13
14
15
# File 'lib/parqueteur/struct.rb', line 13

def field(name, type, options = {}, &block)
  fields.add(Parqueteur::Column.new(name, type, options, &block))
end

#fieldsObject



9
10
11
# File 'lib/parqueteur/struct.rb', line 9

def fields
  @fields ||= Parqueteur::ColumnCollection.new
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/parqueteur/struct.rb', line 17

def key?(key)
  fields.key?(key)
end

#to_arrow_typeObject



21
22
23
# File 'lib/parqueteur/struct.rb', line 21

def to_arrow_type
  fields.collect(&:to_arrow_field)
end