blob: 729cd109240d15cf8d7d11286e7661e7106ef888 (
plain)
1
2
3
4
5
6
7
|
class Range
def intersection(other)
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
|