Globbing/pathname expansion with colon as separator
This should do it for you:
dirs=(/var/lib/gems/*/bin) # put filenames (dirnames) in an arraysaveIFS=$IFS IFS=':' # set the Internal Field Separator to the desired delimiterdirs=("${dirs[*]}") # convert the array to a scalar with the new delimiterIFS=$saveIFS # restore IFS