revert 3644f1ba temporary since it caused SEGV only on Travis-CI

parent 0584551e
...@@ -14,8 +14,11 @@ module Comparable ...@@ -14,8 +14,11 @@ module Comparable
cmp = self <=> other cmp = self <=> other
if cmp.nil? if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
elsif cmp < 0
true
else
false
end end
cmp < 0
end end
## ##
...@@ -28,8 +31,11 @@ module Comparable ...@@ -28,8 +31,11 @@ module Comparable
cmp = self <=> other cmp = self <=> other
if cmp.nil? if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
elsif cmp <= 0
true
else
false
end end
cmp <= 0
end end
## ##
...@@ -40,7 +46,11 @@ module Comparable ...@@ -40,7 +46,11 @@ module Comparable
# ISO 15.3.3.2.3 # ISO 15.3.3.2.3
def == other def == other
cmp = self <=> other cmp = self <=> other
cmp == 0 if cmp == 0
true
else
false
end
end end
## ##
...@@ -53,8 +63,11 @@ module Comparable ...@@ -53,8 +63,11 @@ module Comparable
cmp = self <=> other cmp = self <=> other
if cmp.nil? if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
elsif cmp > 0
true
else
false
end end
cmp > 0
end end
## ##
...@@ -67,8 +80,11 @@ module Comparable ...@@ -67,8 +80,11 @@ module Comparable
cmp = self <=> other cmp = self <=> other
if cmp.nil? if cmp.nil?
raise ArgumentError, "comparison of #{self.class} with #{other.class} failed" raise ArgumentError, "comparison of #{self.class} with #{other.class} failed"
elsif cmp >= 0
true
else
false
end end
cmp >= 0
end end
## ##
...@@ -79,6 +95,10 @@ module Comparable ...@@ -79,6 +95,10 @@ module Comparable
# #
# ISO 15.3.3.2.6 # ISO 15.3.3.2.6
def between?(min, max) def between?(min, max)
self >= min and self <= max if self < min or self > max
false
else
true
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment