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.
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_unit ⇒ Object (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_zone ⇒ Object (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_s ⇒ Object
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 |