I've got a string that I'm splitting, as follows:
foo, bar, baz, etc = str.split(',')
If, for example, str is equal to "one,two,,four", then baz ends up equalling "" (an empty string). Is there any easy way to loop through these for parameters to convert them to nil if they're an empty string? Or am I stuck doing the following?
foo = nil if foo.blank?
bar = nil if bar.blank?
baz = nil if baz.blank?
etc = nil if etc.blank?