blob: 5afb44dee62ae369528e9947fbee5d346eae7e8c (
plain)
1
2
3
4
5
6
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
end
alias_method :&, :intersection
end
|