added ruby implementation