Class: Polars::Array
- Inherits:
-
NestedType
- Object
- DataType
- NestedType
- Polars::Array
- Defined in:
- lib/polars/data_types.rb
Overview
Nested list/array type.
Instance Attribute Summary collapse
-
#inner ⇒ Object
readonly
Returns the value of attribute inner.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(inner, width) ⇒ Array
constructor
A new instance of Array.
- #to_s ⇒ Object
Constructor Details
#initialize(inner, width) ⇒ Array
Returns a new instance of Array.
451 452 453 454 455 456 457 |
# File 'lib/polars/data_types.rb', line 451 def initialize(inner, width) if width.is_a?(DataType) || (width.is_a?(Class) && width < DataType) inner, width = width, inner end @inner = Utils.rb_type_to_dtype(inner) if inner @width = width end |
Instance Attribute Details
#inner ⇒ Object (readonly)
Returns the value of attribute inner.
449 450 451 |
# File 'lib/polars/data_types.rb', line 449 def inner @inner end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
449 450 451 |
# File 'lib/polars/data_types.rb', line 449 def width @width end |
Instance Method Details
#==(other) ⇒ Object
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/polars/data_types.rb', line 459 def ==(other) if other.eql?(Array) true elsif other.is_a?(Array) if @width != other.width false elsif @inner.nil? || other.inner.nil? true else @inner == other.inner end else false end end |
#to_s ⇒ Object
475 476 477 |
# File 'lib/polars/data_types.rb', line 475 def to_s "#{self.class.name}(#{inner}, width: #{width.inspect})" end |