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.
391 392 393 394 395 396 397 |
# File 'lib/polars/data_types.rb', line 391 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.
389 390 391 |
# File 'lib/polars/data_types.rb', line 389 def inner @inner end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
389 390 391 |
# File 'lib/polars/data_types.rb', line 389 def width @width end |
Instance Method Details
#==(other) ⇒ Object
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/polars/data_types.rb', line 399 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
415 416 417 |
# File 'lib/polars/data_types.rb', line 415 def to_s "#{self.class.name}(#{inner}, width: #{width.inspect})" end |