Inspired from a commercial product made in metal and with a ruler in inches, this caliper fits in any pocket and alows to mesure inner or outer dimensions up to 5 centimeters.
Just find a piece of nail or whatever fits in the holes to articulate both parts. A personnaly used the last segment of a old broken antenna. It gives a shiny finish !
After that, print the ruler. Put a doubled sided adhesive tape on its back and cut it to size.
With the caliper on "0" position, carefully put the ruler in place. You'r done !
EDIT: 13/05/2019 : Some asked for an imperial version, so I added a pdf ruler in inches. Not tested yet. Feel free to feedback me about it.