Looks like compact doesn't remove empty strings. How about `.select{ |x| x != "" }`?