Class: Polars::Array

Inherits:
NestedType show all
Defined in:
lib/polars/data_types.rb

Overview

Nested list/array type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, inner = nil) ⇒ Array



233
234
235
236
# File 'lib/polars/data_types.rb', line 233

def initialize(width, inner = nil)
  @width = width
  @inner = Utils.rb_type_to_dtype(inner) if inner
end

Instance Attribute Details

#innerObject (readonly)

Returns the value of attribute inner.



231
232
233
# File 'lib/polars/data_types.rb', line 231

def inner
  @inner
end

#widthObject (readonly)

Returns the value of attribute width.



231
232
233
# File 'lib/polars/data_types.rb', line 231

def width
  @width
end

Instance Method Details

#==(other) ⇒ Object

TODO check width?



239
240
241
242
243
244
245
246
247
# File 'lib/polars/data_types.rb', line 239

def ==(other)
  if other.eql?(Array)
    true
  elsif other.is_a?(Array)
    @inner.nil? || other.inner.nil? || @inner == other.inner
  else
    false
  end
end

#to_sObject

TODO add width?



250
251
252
# File 'lib/polars/data_types.rb', line 250

def to_s
  "#{self.class.name}(#{inner})"
end