Class: Parqueteur::Struct
- Inherits:
-
Object
- Object
- Parqueteur::Struct
- Defined in:
- lib/parqueteur/struct.rb
Instance Method Summary collapse
- #field(name, type, options = {}, &block) ⇒ Object
- #fields ⇒ Object
-
#initialize(&block) ⇒ Struct
constructor
A new instance of Struct.
- #key?(key) ⇒ Boolean
- #to_arrow_type ⇒ Object
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, = {}, &block) fields.add(Parqueteur::Column.new(name, type, , &block)) end |
#fields ⇒ Object
9 10 11 |
# File 'lib/parqueteur/struct.rb', line 9 def fields @fields ||= Parqueteur::ColumnCollection.new end |
#key?(key) ⇒ Boolean
17 18 19 |
# File 'lib/parqueteur/struct.rb', line 17 def key?(key) fields.key?(key) end |
#to_arrow_type ⇒ Object
21 22 23 |
# File 'lib/parqueteur/struct.rb', line 21 def to_arrow_type fields.collect(&:to_arrow_field) end |