From: "Aaron D. Gifford" Date: 2011-03-26T21:37:24+09:00 Subject: Re: shortcut for add unless nil ? I was heard to muse: > An alternative for the original poster's ENV variables potentially > containing colon-separated paths: > >  %w{FOO BAR BAZ}.map{|x| ENV[x].to_s}.join(':').split(/:+/) > > The .to_s should handle nil just fine. Concatenate all the strings, > then do the split. Append a .uniq to that as desired. Or do: %w{FOO BAR BAZ}.map{|x| ENV[x].to_s.split(/:+/) || []}.flatten.uniq Aaron out.