0
我想設置一個布爾變量來切換Net::Telnet模塊在日誌路徑,即:紅寶石網/遠程登錄使用布爾切換登錄
telnetdebug = false
telnetlog = false
telnetlogfile = '/var/log/mcacheMonitor.telnet.log'
xmr = Net::Telnet.new("Host" => host,
"Timeout" => 10,
"Prompt" => /[#]\z/n,
'Waittime' => 0,
'Dump_log' => telnetdebug ? "mcmsDebug.log" : nil,
'Output_log' => telnetlog ? telnetlogfile : nil)
但是這個代碼產生以下錯誤:
C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize': can't convert nil into String (TypeError)
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `open'
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize'
from mcw.rb:26:in `new'
from mcw.rb:26:in `<main>'
一個很好的例子「使用源盧克!」。 –