Class: BSON::Decimal128::Builder::FromString Private
- Inherits:
-
Object
- Object
- BSON::Decimal128::Builder::FromString
- 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 parsing a String into Decimal128 high and low bits.
Constant Summary collapse
- NAN_REGEX =
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.
Regex matching a string representing NaN.
/^(\-)?(S)?NaN$/i.freeze
- INFINITY_REGEX =
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.
Regex matching a string representing positive or negative Infinity.
/^(\+|\-)?Inf(inity)?$/i.freeze
- SIGNIFICAND_WITH_LEADING_ZEROS_REGEX =
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.
Regex for the fraction, including leading zeros.
/(0*)(\d+)/.freeze
- SIGN_AND_DIGITS_REGEX =
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.
Regex for separating a negative sign from the significands.
/^(\-)?(\S+)/.freeze
- SCIENTIFIC_EXPONENT_REGEX =
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.
Regex matching a scientific exponent.
/E\+?/i.freeze
- TRAILING_ZEROS_REGEX =
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.
Regex for capturing trailing zeros.
/[1-9]*(0+)$/.freeze
- VALID_DECIMAL128_STRING_REGEX =
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.
Regex for a valid decimal128 string format.
/^[\-\+]?(\d+(\.\d*)?|\.\d+)(E[\-\+]?\d+)?$/i.freeze
Instance Method Summary collapse
-
#bits ⇒ Array
private
Get the bits representing the Decimal128 that the string corresponds to.
-
#initialize(string) ⇒ FromString
constructor
private
Initialize the FromString Builder object.
Constructor Details
#initialize(string) ⇒ FromString
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 FromString Builder object.
163 164 165 |
# File 'lib/bson/decimal128/builder.rb', line 163 def initialize(string) @string = string end |
Instance Method Details
#bits ⇒ Array
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 bits representing the Decimal128 that the string corresponds to.
175 176 177 178 179 180 181 182 |
# File 'lib/bson/decimal128/builder.rb', line 175 def bits if special? to_special_bits else validate_format! to_bits end end |