试过以下红宝石条件参数,如何检查零?
def pkill(process_name, *host)
puts host.nil? # => false
puts host.empty? # => true
puts host # => nil
puts host[0].nil? # => true
end
现在如果我叫send("pkill", blah, nil)
,如何/为什么host
假的?
很新的红宝石,所以保持平稳:)
都能跟得上:('host.empty?'也是假的... – Shrinath 2012-04-18 10:48:56
然后你正在做别的事情。红宝石你是什么呢?我在1.9.3 – 2012-04-18 10:50:15
红宝石1.8.7(2010-08-16 patchlevel 302)[x86_64-linux] – Shrinath 2012-04-18 10:51:49