diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-14 08:29:37 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-12-14 08:29:37 -0300 |
commit | 7975ad8b3ccad74598cddb7e8e3e50f0c413e8f7 (patch) | |
tree | 60ad29baf1da90001febba1e771ebdb20a53ac85 /lib/highline | |
parent | c66300ef64f0fb22b819625d41e403a157f9c4d1 (diff) | |
download | highline-7975ad8b3ccad74598cddb7e8e3e50f0c413e8f7.tar.gz |
Deprecate HighLine::Terminal::CHARACTER_MODE constant and unify #character_mode approach
Diffstat (limited to 'lib/highline')
-rwxr-xr-x | lib/highline/terminal.rb | 6 | ||||
-rw-r--r-- | lib/highline/terminal/io_console.rb | 9 | ||||
-rw-r--r-- | lib/highline/terminal/ncurses.rb | 1 | ||||
-rw-r--r-- | lib/highline/terminal/unix_stty.rb | 9 |
4 files changed, 6 insertions, 19 deletions
diff --git a/lib/highline/terminal.rb b/lib/highline/terminal.rb index ac06b3b..a76a136 100755 --- a/lib/highline/terminal.rb +++ b/lib/highline/terminal.rb @@ -172,6 +172,12 @@ class HighLine # @!endgroup + # Returns the class name as String. Useful for debuggin. + # @return [String] class name. Ex: "HighLine::Terminal::IOConsole" + def character_mode + self.class.name + end + private # Yield a block using stty shell commands to preserve the terminal state. diff --git a/lib/highline/terminal/io_console.rb b/lib/highline/terminal/io_console.rb index b39e675..eee152f 100644 --- a/lib/highline/terminal/io_console.rb +++ b/lib/highline/terminal/io_console.rb @@ -10,10 +10,6 @@ class HighLine output.winsize.reverse end - # Easy to query active terminal (character mode). - # For debugging purposes. - CHARACTER_MODE = "io_console" # For Debugging purposes only. - # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode input.echo = false @@ -28,11 +24,6 @@ class HighLine def get_character input.getch # from ruby io/console end - - # Same as CHARACTER_MODE constant. "io_console" - def character_mode - "io_console" - end end end end
\ No newline at end of file diff --git a/lib/highline/terminal/ncurses.rb b/lib/highline/terminal/ncurses.rb index dda193a..817cc23 100644 --- a/lib/highline/terminal/ncurses.rb +++ b/lib/highline/terminal/ncurses.rb @@ -6,7 +6,6 @@ class HighLine # @note Code migrated +UNTESTED+ from the old code base to the new terminal api. class NCurses < Terminal require 'ffi-ncurses' - CHARACTER_MODE = "ncurses" # For Debugging purposes only. # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode diff --git a/lib/highline/terminal/unix_stty.rb b/lib/highline/terminal/unix_stty.rb index 46e87f4..3b9668a 100644 --- a/lib/highline/terminal/unix_stty.rb +++ b/lib/highline/terminal/unix_stty.rb @@ -27,10 +27,6 @@ class HighLine end end - # Easy to query active terminal (character mode). - # For debugging purposes. - CHARACTER_MODE = "unix_stty" - # (see Terminal#raw_no_echo_mode) def raw_no_echo_mode @state = `stty -g` @@ -47,11 +43,6 @@ class HighLine def get_character( input = STDIN ) input.getc end - - # Same as CHARACTER_MODE constant. "unix_stty" - def character_mode - "unix_stty" - end end end end
\ No newline at end of file |