Class: Polars::Duration

Inherits:
TemporalType show all
Defined in:
lib/polars/data_types.rb

Overview

Time duration/delta type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time_unit = "us") ⇒ Duration

Returns a new instance of Duration.



300
301
302
# File 'lib/polars/data_types.rb', line 300

def initialize(time_unit = "us")
  @time_unit = time_unit
end

Instance Attribute Details

#time_unitObject (readonly) Also known as: tu

Returns the value of attribute time_unit.



297
298
299
# File 'lib/polars/data_types.rb', line 297

def time_unit
  @time_unit
end

Instance Method Details

#==(other) ⇒ Object



304
305
306
307
308
309
310
311
312
# File 'lib/polars/data_types.rb', line 304

def ==(other)
  if other.eql?(Duration)
    true
  elsif other.is_a?(Duration)
    time_unit == other.time_unit
  else
    false
  end
end

#to_sObject



314
315
316
# File 'lib/polars/data_types.rb', line 314

def to_s
  "#{self.class.name}(time_unit: #{time_unit.inspect})"
end