From b4043256d073228ee93b861f15bac24f7c19bffb Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 2 Apr 2014 18:04:09 +0900 Subject: implement part of Array#<=> in C --- mrblib/array.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mrblib/array.rb') diff --git a/mrblib/array.rb b/mrblib/array.rb index fedf4f33c..16e69d5d1 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -145,12 +145,12 @@ class Array # # ISO 15.2.12.5.36 (x) def <=>(other) + other = self.__ary_cmp(other) + return 0 if 0 == other + return nil if nil == other + len = self.size - begin - n = other.size - rescue NoMethodError - return nil - end + n = other.size if len > n len = n end -- cgit v1.2.3