summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-27 02:52:04 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-27 02:52:04 +0900
commit855a3f599188ef0e3c86f95410317d7f212e6ceb (patch)
tree42f3aeb82a42761c248aac3d3532b4025d77f755
parent4e790fc1b6193449f6cf22be709d3111191e3ed7 (diff)
downloadmruby-855a3f599188ef0e3c86f95410317d7f212e6ceb.tar.gz
mruby-855a3f599188ef0e3c86f95410317d7f212e6ceb.zip
re-apply 3644f1b since we have fixed GC bug
-rw-r--r--mrblib/compar.rb32
1 files changed, 6 insertions, 26 deletions
diff --git a/mrblib/compar.rb b/mrblib/compar.rb
index 44595974a..84b962598 100644
--- a/mrblib/compar.rb
+++ b/mrblib/compar.rb
@@ -14,11 +14,8 @@ module Comparable
cmp = self <=> other
if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
- elsif cmp < 0
- true
- else
- false
end
+ cmp < 0
end
##
@@ -31,11 +28,8 @@ module Comparable
cmp = self <=> other
if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
- elsif cmp <= 0
- true
- else
- false
end
+ cmp <= 0
end
##
@@ -46,11 +40,7 @@ module Comparable
# ISO 15.3.3.2.3
def == other
cmp = self <=> other
- if cmp == 0
- true
- else
- false
- end
+ cmp == 0
end
##
@@ -63,11 +53,8 @@ module Comparable
cmp = self <=> other
if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
- elsif cmp > 0
- true
- else
- false
end
+ cmp > 0
end
##
@@ -80,11 +67,8 @@ module Comparable
cmp = self <=> other
if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
- elsif cmp >= 0
- true
- else
- false
end
+ cmp >= 0
end
##
@@ -95,10 +79,6 @@ module Comparable
#
# ISO 15.3.3.2.6
def between?(min, max)
- if self < min or self > max
- false
- else
- true
- end
+ self >= min and self <= max
end
end