Class: ArrowFormat::Field
- Inherits:
-
Object
- Object
- ArrowFormat::Field
- Defined in:
- lib/arrow-format/field.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, nullable: true, metadata: nil) ⇒ Field
constructor
A new instance of Field.
- #nullable? ⇒ Boolean
- #to_flatbuffers ⇒ Object
Constructor Details
#initialize(name, type, nullable: true, metadata: nil) ⇒ Field
Returns a new instance of Field.
22 23 24 25 26 27 28 29 30 |
# File 'lib/arrow-format/field.rb', line 22 def initialize(name, type, nullable: true, metadata: nil) @name = name @type = type @nullable = nullable @metadata = end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
21 22 23 |
# File 'lib/arrow-format/field.rb', line 21 def @metadata end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/arrow-format/field.rb', line 19 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
20 21 22 |
# File 'lib/arrow-format/field.rb', line 20 def type @type end |
Instance Method Details
#nullable? ⇒ Boolean
32 33 34 |
# File 'lib/arrow-format/field.rb', line 32 def nullable? @nullable end |
#to_flatbuffers ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/arrow-format/field.rb', line 36 def to_flatbuffers fb_field = FB::Field::Data.new fb_field.name = @name fb_field.nullable = @nullable if @type.respond_to?(:build_fb_field) @type.build_fb_field(fb_field) else fb_field.type = @type.to_flatbuffers end if @type.respond_to?(:child) fb_field.children = [@type.child.to_flatbuffers] elsif @type.respond_to?(:children) fb_field.children = @type.children.collect(&:to_flatbuffers) end fb_field. = FB.(@metadata) fb_field end |