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.



249
250
251
252
# File 'lib/polars/data_types.rb', line 249

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.



246
247
248
# File 'lib/polars/data_types.rb', line 246

def time_unit
  @time_unit
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



246
247
248
# File 'lib/polars/data_types.rb', line 246

def time_zone
  @time_zone
end

Instance Method Details

#==(other) ⇒ Object



254
255
256
257
258
259
260
261
262
# File 'lib/polars/data_types.rb', line 254

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



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

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