IronRuby.Builtins.Comparable.Equal C# (CSharp) Method

Equal() private method

private Equal ( BinaryOpStorage compareStorage, object self, object other ) : object
compareStorage BinaryOpStorage
self object
other object
return object
        public static object Equal(BinaryOpStorage/*!*/ compareStorage, object self, object other) {

            if (self == other) {
                return ScriptingRuntimeHelpers.True;
            }

            // calls method_missing:
            var compare = compareStorage.GetCallSite("<=>");

            object compareResult;
            try {
                compareResult = compare.Target(compare, self, other);
            } catch (SystemException) {
                // catches StandardError (like rescue)
                return null;
            }

            if (compareResult == null || !(compareResult is int)) {
                return null;
            }

            return ScriptingRuntimeHelpers.BooleanToObject((int)compareResult == 0);
        }
    }