Class: Arrow::Decimal128

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/decimal128.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.try_convert(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
28
29
30
31
# File 'lib/arrow/decimal128.rb', line 22

def try_convert(value)
  case value
  when String
    new(value)
  when Float
    new(value.to_s)
  else
    nil
  end
end

Instance Method Details

#absObject

Since:

  • 3.0.0



59
60
61
62
63
# File 'lib/arrow/decimal128.rb', line 59

def abs
  copied = dup
  copied.abs!
  copied
end

#abs!Object



56
# File 'lib/arrow/decimal128.rb', line 56

alias_method :abs!, :abs

#negateObject

Since:

  • 3.0.0



68
69
70
71
72
# File 'lib/arrow/decimal128.rb', line 68

def negate
  copied = dup
  copied.negate!
  copied
end

#negate!Object



65
# File 'lib/arrow/decimal128.rb', line 65

alias_method :negate!, :negate

#to_sString #to_s(scale) ⇒ String

Overloads:

  • #to_sString

    Returns The string representation of the decimal.

    Returns:

    • (String)

      The string representation of the decimal.

  • #to_s(scale) ⇒ String

    Returns The string representation of the decimal including the scale.

    Parameters:

    • scale (Integer)

      The scale of the decimal.

    Returns:

    • (String)

      The string representation of the decimal including the scale.

Since:

  • 0.13.0



48
49
50
51
52
53
54
# File 'lib/arrow/decimal128.rb', line 48

def to_s(scale=nil)
  if scale
    to_string_scale(scale)
  else
    to_s_raw
  end
end

#to_s_rawObject



34
# File 'lib/arrow/decimal128.rb', line 34

alias_method :to_s_raw, :to_s