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
- 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
- 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+)/
- 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+)/
- 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
- 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+)$/
- 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.
/\A[\-\+]?(\d+(\.\d*)?|\.\d+)(E[\-\+]?\d+)?\Z/i
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.
169 170 171 |
# File 'lib/bson/decimal128/builder.rb', line 169 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.
181 182 183 184 185 186 187 188 |
# File 'lib/bson/decimal128/builder.rb', line 181 def bits if special? to_special_bits else validate_format! to_bits end end |