Class: BSON::Decimal128::Builder::ToString Private
- Inherits:
-
Object
- Object
- BSON::Decimal128::Builder::ToString
- Defined in:
- lib/bson/decimal128/builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Helper class for getting a String representation of a Decimal128 object.
Constant Summary collapse
- NAN_STRING =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
String representing a NaN value.
'NaN'
- INFINITY_STRING =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
String representing an Infinity value.
'Infinity'
Instance Method Summary collapse
-
#initialize(decimal128) ⇒ ToString
constructor
private
Initialize the FromBigDecimal Builder object.
-
#string ⇒ String
private
Get the string representing the Decimal128 object.
Constructor Details
#initialize(decimal128) ⇒ ToString
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.
Initialize the FromBigDecimal Builder object.
364 365 366 |
# File 'lib/bson/decimal128/builder.rb', line 364 def initialize(decimal128) @decimal128 = decimal128 end |
Instance Method Details
#string ⇒ String
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.
The returned string may be frozen.
Get the string representing the Decimal128 object.
378 379 380 381 382 |
# File 'lib/bson/decimal128/builder.rb', line 378 def string return NAN_STRING if nan? str = infinity? ? INFINITY_STRING : create_string negative? ? "-#{str}" : str end |