module Zashoku::Util::Term

Public Class Methods

cols() click to toggle source
# File lib/core/util/term.rb, line 32
def self.cols
  HighLine::SystemExtensions.terminal_size[0]
end
echo_off() click to toggle source
# File lib/core/util/term.rb, line 22
def self.echo_off
  `stty -echo`
  self
end
echo_on() click to toggle source
# File lib/core/util/term.rb, line 27
def self.echo_on
  `stty echo`
  self
end
ini() click to toggle source
# File lib/core/util/term.rb, line 56
def self.ini
  save.hide_cursor.echo_off
end
reset() click to toggle source
# File lib/core/util/term.rb, line 52
def self.reset
  restore.show_cursor.echo_on
end
rows() click to toggle source
# File lib/core/util/term.rb, line 36
def self.rows
  HighLine::SystemExtensions.terminal_size[1]
end

Public Instance Methods

get_key() click to toggle source
# File lib/core/util/term.rb, line 40
def get_key
  STDIN.getch
       .gsub("\r", 'enter')
       .gsub(' ',  'space')
       .gsub('A',  'up')
       .gsub('B',  'down')
       .gsub('C',  'right')
       .gsub('D',  'left')
       .gsub("\e", 'skip')
       .gsub('[',  'skip')
end