Class: Polars::Datetime
- Inherits:
-
TemporalType
- Object
- DataType
- TemporalType
- Polars::Datetime
- Defined in:
- lib/polars/data_types.rb
Overview
Calendar date and time type.
Instance Attribute Summary collapse
-
#time_unit ⇒ Object
(also: #tu)
readonly
Returns the value of attribute time_unit.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(time_unit = "us", time_zone = nil) ⇒ Datetime
constructor
A new instance of Datetime.
- #to_s ⇒ Object
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_unit ⇒ Object (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_zone ⇒ Object (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_s ⇒ Object
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 |