當我在終端中瀏覽我的文件時,清除工作正常。但是在我的CLI程序中,我已經嘗試清除並且無法清除用戶的屏幕。如何在ruby cli中使用bash清除
`clear`
爲什麼目前不能在我的CLI代碼中使用?
睡眠工作。
`sleep 5`
def dealer_hits_until_17
@new_hand = false
while hand_score(@dealer_hand) < 17 && @new_hand == false
puts "Dealer Hits! His hand is now #{@dealer_hand}xxx"
hit(@dealer_hand)
`sleep 1`
`clear`
end
if @new_hand == false
compare_hand_value
end
end
有誰知道我可以把我的紅寶石CLI使清屏?
只是仔細研究文件,如果你沒有找到你所問問題[紅寶石#內核(HTTP:// WWW .ruby-doc.org/core-2.0.0/Kernel.html) –