- Ruby port of the Java version.