class Question::TTY
Public Class Methods
clear()
click to toggle source
# File lib/question/tty.rb, line 52 def self.clear print TTY::CODE::RESTORE print TTY::CODE::CLEAR_DOWN end
input()
click to toggle source
# File lib/question/tty.rb, line 57 def self.input input = $stdin.getch return input unless input == "\e" begin Timeout.timeout(0.01) do input += $stdin.getch input += $stdin.getch end rescue Timeout::Error end input end
interactive(&block)
click to toggle source
# File lib/question/tty.rb, line 39 def self.interactive(&block) begin print TTY::CODE::SAVE sync_value = $stdout.sync $stdout.sync = true print TTY::CODE::HIDE block.call ensure print TTY::CODE::SHOW $stdout.sync = sync_value end end