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



308
309
310
# File 'lib/polars/data_types.rb', line 308

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.



305
306
307
# File 'lib/polars/data_types.rb', line 305

def time_unit
  @time_unit
end

Instance Method Details

#==(other) ⇒ Object



312
313
314
315
316
317
318
319
320
# File 'lib/polars/data_types.rb', line 312

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

#to_sObject



322
323
324
# File 'lib/polars/data_types.rb', line 322

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