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
permalink #initialize(inner, width) ⇒ Array
Returns a new instance of Array.
395 396 397 398 399 400 401 |
# File 'lib/polars/data_types.rb', line 395 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
Instance Method Details
permalink #==(other) ⇒ Object
[View source]
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/polars/data_types.rb', line 403 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 |
permalink #to_s ⇒ Object
[View source]
419 420 421 |
# File 'lib/polars/data_types.rb', line 419 def to_s "#{self.class.name}(#{inner}, width: #{width.inspect})" end |