Class: ArrowFormat::TimeType

Inherits:
TemporalType show all
Defined in:
lib/arrow-format/type.rb

Direct Known Subclasses

Time32Type, Time64Type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bit_width, unit) ⇒ TimeType

Returns a new instance of TimeType.



412
413
414
415
416
# File 'lib/arrow-format/type.rb', line 412

def initialize(bit_width, unit)
  super()
  @bit_width = bit_width
  @unit = unit
end

Instance Attribute Details

#bit_widthObject (readonly)

Returns the value of attribute bit_width.



410
411
412
# File 'lib/arrow-format/type.rb', line 410

def bit_width
  @bit_width
end

#unitObject (readonly)

Returns the value of attribute unit.



411
412
413
# File 'lib/arrow-format/type.rb', line 411

def unit
  @unit
end

Instance Method Details

#to_flatbuffersObject



422
423
424
425
426
427
# File 'lib/arrow-format/type.rb', line 422

def to_flatbuffers
  fb_type = FB::Time::Data.new
  fb_type.bit_width = @bit_width
  fb_type.unit = FB::TimeUnit.try_convert(@unit.to_s.upcase)
  fb_type
end

#to_sObject



418
419
420
# File 'lib/arrow-format/type.rb', line 418

def to_s
  "#{super}(#{unit})"
end