Added ruby implementation