Move metrics into doc/.
Use the new ActiveModel::Model in Document, clean up the code.