D'oh! Old code failed for (0...0)

class Range
  alias orig_max max
  def max
    if ( self.begin.kind_of?(Integer) &&
         self.end.kind_of?(Integer) &&
         ( self.exclude_end? ?
            self.begin < self.end :
            self.begin <= self.end ) )
      self.exclude_end? ? self.end - 1 : self.end
    else
      orig_max
    end
  end
end