Add doctest for class `ref`