aboutsummaryrefslogtreecommitdiffstats
path: root/lib/range_ext.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/range_ext.rb')
-rw-r--r--lib/range_ext.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/range_ext.rb b/lib/range_ext.rb
index 5afb44dee..729cd1092 100644
--- a/lib/range_ext.rb
+++ b/lib/range_ext.rb
@@ -1,7 +1,7 @@
class Range
def intersection(other)
- return nil if (self.max < other.begin or other.max < self.begin)
- [self.begin, other.begin].max..[self.max, other.max].min
+ return nil if (self.max < other.min or other.max < self.min)
+ [self.min, other.min].max..[self.max, other.max].min
end
alias_method :&, :intersection
end