On Fri, Dec 13, 2013 at 7:23 PM, Dave Castellano <lists / ruby-forum.com> wrote:
>>> I need to test for a case where 5 variables are all empty.
>>
>
>> 2.0.0 (main):0 > [ a,b,c,d,e ].all? { |x| x.empty? }
>> => true
>> 2.0.0 (main):0 > a = 'a'
>> => "a"
>> 2.0.0 (main):0 > [ a,b,c,d,e ].all? { |x| x.empty? }
>> => false
>> 2.0.0 (main):0 >

Alternative with identical semantics but a tad less typing:

irb(main):002:0> [a, b, c, d, e].all? &:empty?
=> true

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/