update str2duck logic and export into a gem