Ruby units compatibility

This patch fixes the compatibility issues I described in issue #64.

(This also includes some patches from your old repository since I based my fork on it.)