summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-02 18:04:09 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-02 18:04:09 +0900
commitb4043256d073228ee93b861f15bac24f7c19bffb (patch)
treeb6db10de3db4c684998f3ca45285d5ece24478d1 /mrblib
parent94effc6a3752c60d15c375a0ff69e52878f65e39 (diff)
downloadmruby-b4043256d073228ee93b861f15bac24f7c19bffb.tar.gz
mruby-b4043256d073228ee93b861f15bac24f7c19bffb.zip
implement part of Array#<=> in C
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/array.rb10
1 files changed, 5 insertions, 5 deletions
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