Class: Polars::Datetime

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

Overview

Calendar date and time type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time_unit = "us", time_zone = nil) ⇒ Datetime

Returns a new instance of Datetime.



275
276
277
278
# File 'lib/polars/data_types.rb', line 275

def initialize(time_unit = "us", time_zone = nil)
  @time_unit = time_unit || "us"
  @time_zone = time_zone
end

Instance Attribute Details

#time_unitObject (readonly) Also known as: tu

Returns the value of attribute time_unit.



272
273
274
# File 'lib/polars/data_types.rb', line 272

def time_unit
  @time_unit
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



272
273
274
# File 'lib/polars/data_types.rb', line 272

def time_zone
  @time_zone
end

Instance Method Details

#==(other) ⇒ Object



280
281
282
283
284
285
286
287
288
# File 'lib/polars/data_types.rb', line 280

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

#to_sObject



290
291
292
# File 'lib/polars/data_types.rb', line 290

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