Class: Polars::Decimal
- Inherits:
-
FractionalType
- Object
- DataType
- NumericType
- FractionalType
- Polars::Decimal
- Defined in:
- lib/polars/data_types.rb
Overview
Decimal 128-bit type with an optional precision and non-negative scale.
NOTE: this is an experimental work-in-progress feature and may not work as expected.
Instance Attribute Summary collapse
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(precision, scale) ⇒ Decimal
constructor
A new instance of Decimal.
- #to_s ⇒ Object
Constructor Details
#initialize(precision, scale) ⇒ Decimal
Returns a new instance of Decimal.
98 99 100 101 |
# File 'lib/polars/data_types.rb', line 98 def initialize(precision, scale) @precision = precision @scale = scale end |
Instance Attribute Details
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
96 97 98 |
# File 'lib/polars/data_types.rb', line 96 def precision @precision end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
96 97 98 |
# File 'lib/polars/data_types.rb', line 96 def scale @scale end |
Instance Method Details
#==(other) ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/polars/data_types.rb', line 103 def ==(other) if other.eql?(Decimal) true elsif other.is_a?(Decimal) precision == other.precision && scale == other.scale else false end end |
#to_s ⇒ Object
113 114 115 |
# File 'lib/polars/data_types.rb', line 113 def to_s "#{self.class.name}(precision: #{precision.inspect}, scale: #{scale.inspect})" end |