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'.freeze
- 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'.freeze
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.
358 359 360 |
# File 'lib/bson/decimal128/builder.rb', line 358 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.
Get the string representing the Decimal128 object.
370 371 372 373 374 |
# File 'lib/bson/decimal128/builder.rb', line 370 def string return NAN_STRING if nan? str = infinity? ? INFINITY_STRING : create_string negative? ? '-' << str : str end |