Is there a rails function to detect ["", "", ...]
(i.e. An array containing only empty string or strings) as empty
My requirement:
[""].foo?
=> true
["", ""].foo?
=> true
["lorem"].foo?
=> false
["", "ipsum"].foo?
=> false
I tried using array.reject!(&:empty?).blank?
. It worked, but this changed my array. I don't want my array to be changed. Please help me find a compact method.
No comments:
Post a Comment