Class: Polars::Duration
- Inherits:
-
TemporalType
- Object
- DataType
- TemporalType
- Polars::Duration
- Defined in:
- lib/polars/data_types.rb
Overview
Time duration/delta type.
Instance Attribute Summary collapse
-
#time_unit ⇒ Object
(also: #tu)
readonly
Returns the value of attribute time_unit.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(time_unit = "us") ⇒ Duration
constructor
A new instance of Duration.
- #to_s ⇒ Object
Constructor Details
#initialize(time_unit = "us") ⇒ Duration
Returns a new instance of Duration.
274 275 276 |
# File 'lib/polars/data_types.rb', line 274 def initialize(time_unit = "us") @time_unit = time_unit end |
Instance Attribute Details
#time_unit ⇒ Object (readonly) Also known as: tu
Returns the value of attribute time_unit.
271 272 273 |
# File 'lib/polars/data_types.rb', line 271 def time_unit @time_unit end |
Instance Method Details
#==(other) ⇒ Object
278 279 280 281 282 283 284 285 286 |
# File 'lib/polars/data_types.rb', line 278 def ==(other) if other.eql?(Duration) true elsif other.is_a?(Duration) time_unit == other.time_unit else false end end |
#to_s ⇒ Object
288 289 290 |
# File 'lib/polars/data_types.rb', line 288 def to_s "#{self.class.name}(time_unit: #{time_unit.inspect})" end |