diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-10-18 23:28:53 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-10-19 00:00:47 -0300 |
commit | 43f51c7d1c86a7bfdca15791c50c467f98ba49f3 (patch) | |
tree | e61620ebfdc08bb56f3b57181e416cd1c194638f /lib | |
parent | 5340bdc21ee54549d39a1d63736cea916049da78 (diff) | |
download | highline-43f51c7d1c86a7bfdca15791c50c467f98ba49f3.tar.gz |
Expose IOConsoleCompatible
Diffstat (limited to 'lib')
-rw-r--r-- | lib/highline/io_console_compatible.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/highline/io_console_compatible.rb b/lib/highline/io_console_compatible.rb new file mode 100644 index 0000000..7ff06f5 --- /dev/null +++ b/lib/highline/io_console_compatible.rb @@ -0,0 +1,37 @@ +# coding: utf-8 + +require "stringio" +require "tempfile" + +# +# On tests, we try to simulate input output with +# StringIO, Tempfile and File objects. +# +# For this to be accomplished, we have to do some +# tweaking so that they respond adequately to the +# called methods during tests. +# + +module IOConsoleCompatible + def getch + getc + end + + attr_accessor :echo + + def winsize + [24, 80] + end +end + +class Tempfile + include IOConsoleCompatible +end + +class File + include IOConsoleCompatible +end + +class StringIO + include IOConsoleCompatible +end |