port wichtel from java to ruby