Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Range#=== is not an alias for #include? on 1.9

  • Loading branch information...
commit d1ecf2c4a40685a1c66d8946260a090755d0cc63 1 parent b0d2e6d
@jfirebaugh jfirebaugh authored
View
5 kernel/common/range.rb
@@ -32,7 +32,7 @@ def ==(other)
end
alias_method :eql?, :==
- def ===(value)
+ def include?(value)
# MRI uses <=> to compare, so must we.
beg_compare = (@begin <=> value)
@@ -49,8 +49,7 @@ def ===(value)
return false
end
- alias_method :member?, :===
- alias_method :include?, :===
+ alias_method :member?, :include?
attr_reader_specific :excl, :exclude_end?
View
2  kernel/common/range18.rb
@@ -1,6 +1,8 @@
# -*- encoding: us-ascii -*-
class Range
+ alias_method :===, :include?
+
protected
def can_iterate_from?(object)
View
6 kernel/common/range19.rb
@@ -1,7 +1,11 @@
# -*- encoding: us-ascii -*-
class Range
- alias_method :cover?, :===
+ def ===(value)
+ include?(value)
+ end
+
+ alias_method :cover?, :include?
def max(&block)
raise TypeError, "cannot exclude non Integer end value" if @end.kind_of?(Float) && @excl
Please sign in to comment.
Something went wrong with that request. Please try again.