Esempio n. 1
0
            private double ReadFloat()
            {
                MutableString value = ReadString();

                if (value.Equals(_positiveInfinityString))
                {
                    return(Double.PositiveInfinity);
                }
                if (value.Equals(_negativeInfinityString))
                {
                    return(Double.NegativeInfinity);
                }
                if (value.Equals(_nanString))
                {
                    return(Double.NaN);
                }

                // TODO: MRI appears to have an optimization that saves the (binary) mantissa at the end of the string
                int pos = value.IndexOf((byte)0);

                if (pos >= 0)
                {
                    value.Remove(pos, value.Length - pos);
                }
                return(Protocols.ConvertStringToFloat(Context, value));
            }
Esempio n. 2
0
 public bool Equals(RubyRegex other)
 {
     return(ReferenceEquals(this, other) ||
            other != null && _options.Equals(other._options) && _pattern.Equals(other._pattern));
 }
Esempio n. 3
0
 public static bool StringEquals(string /*!*/ lhs, [NotNull] MutableString /*!*/ rhs)
 {
     // TODO: do not create MS
     return(rhs.Equals(MutableString.Create(lhs, RubyEncoding.UTF8)));
 }
Esempio n. 4
0
 public bool Equals(MutableString other)
 {
     return(other != null && _string.Equals(other));
 }
Esempio n. 5
0
 public static bool Eql(string /*!*/ lhs, [NotNull] MutableString /*!*/ rhs)
 {
     return(rhs.Equals(lhs));
 }