Improve doc extraction from ruby files.

Some documentation uses string templates that are constants declared
in the same block as the documentation. With this commit it is
ensured that strings embedding such constants are expanded correctly.