I submitted a PR on Github https://github.com/rails/rails/pull/7008 for an 
ActiveSupport method that removes nils and blanks from arrays and 
hashes. Something like...

[1,2,nil,3,['',4].clean # => [1,2,3,[4]]

I'd be curious to hear peoples opinions on code & concept. I've wanted 
something like this in the past when preprocessing form params and parsing 
CSV data w/ a lot of empty values. It's very similar to #compact but also 
removes any empty strings. It is recursive so nested data is cleaned as 
well. 

Cheers,
Sean

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/gWtkI_wSkM0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to