Ruby port of php library of the same name