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.



264
265
266
267
# File 'lib/polars/data_types.rb', line 264

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.



261
262
263
# File 'lib/polars/data_types.rb', line 261

def time_unit
  @time_unit
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



261
262
263
# File 'lib/polars/data_types.rb', line 261

def time_zone
  @time_zone
end

Instance Method Details

#==(other) ⇒ Object



269
270
271
272
273
274
275
276
277
# File 'lib/polars/data_types.rb', line 269

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



279
280
281
# File 'lib/polars/data_types.rb', line 279

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