added ruby version of inversion algo