Class: Polars::Field

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

Overview

Definition of a single field within a Struct DataType.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, dtype) ⇒ Field

Returns a new instance of Field.



422
423
424
425
# File 'lib/polars/data_types.rb', line 422

def initialize(name, dtype)
  @name = name
  @dtype = Utils.rb_type_to_dtype(dtype)
end

Instance Attribute Details

#dtypeObject (readonly)

Returns the value of attribute dtype.



420
421
422
# File 'lib/polars/data_types.rb', line 420

def dtype
  @dtype
end

#nameObject (readonly)

Returns the value of attribute name.



420
421
422
# File 'lib/polars/data_types.rb', line 420

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



427
428
429
# File 'lib/polars/data_types.rb', line 427

def ==(other)
  name == other.name && dtype == other.dtype
end

#to_sObject



431
432
433
# File 'lib/polars/data_types.rb', line 431

def to_s
  "#{self.class.name}(#{name.inspect}, #{dtype})"
end