class Range

Public Instance Methods

&(other)
Alias for: intersection
intersection(other) click to toggle source
# File lib/ext/core_ext.rb, line 12
def intersection(other)
  raise ArgumentError, 'value must be a Range' unless other.kind_of?(Range)
  return nil if (self.max < other.begin or other.max < self.begin) 
  [self.begin, other.begin].max..[self.max, other.max].min
end
Also aliased as: &