【发布时间】:2013-12-14 15:26:43
【问题描述】:
当我只是在终端中浏览文件时,Clear 可以正常工作。但是在我的 CLI 程序中,
我已尝试清除,但无法清除用户的屏幕。
`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
有谁知道我可以在我的 Ruby CLI 中添加什么来清除屏幕?
【问题讨论】:
-
只要仔细研究文档,如果你没有找到你问的问题Ruby#Kernel
标签: ruby bash terminal command-line-interface