示例#1
0
 /// <summary>
 /// Check that the object, when converted to an integer, is not less than or equal to zero.
 /// </summary>
 private static void CheckStep(RubyContext /*!*/ context, object step)
 {
     if (RubySites.Equal(context, step, 0))
     {
         throw RubyExceptions.CreateArgumentError("step can't be 0");
     }
     if (RubyOps.IsTrue(LibrarySites.LessThan(context, step, 0)))
     {
         throw RubyExceptions.CreateArgumentError("step can't be negative");
     }
 }
示例#2
0
        public static bool Equals(RubyStruct /*!*/ self, object obj)
        {
            var other = obj as RubyStruct;

            if (!self.StructReferenceEquals(other))
            {
                return(false);
            }

            Debug.Assert(self.ItemCount == other.ItemCount);
            for (int i = 0; i < self.Values.Length; i++)
            {
                if (!RubySites.Equal(self.Class.Context, self.Values[i], other.Values[i]))
                {
                    return(false);
                }
            }

            return(true);
        }