lib/tty/terminal/echo.rb in tty-0.0.11 vs lib/tty/terminal/echo.rb in tty-0.1.0
- old
+ new
@@ -1,13 +1,11 @@
-# -*- encoding: utf-8 -*-
+# encoding: utf-8
module TTY
class Terminal
-
# A class responsible for toggling echo.
class Echo
-
# Turn echo on
#
# @api public
def on
%x{stty echo} if TTY::System.unix?
@@ -24,18 +22,17 @@
#
# @api public
def echo(is_on=true, &block)
value = nil
begin
- self.off unless is_on
+ off unless is_on
value = block.call if block_given?
- self.on
+ on
return value
rescue NoMethodError, Interrupt
- self.on
+ on
exit
end
end
-
end # Echo
end # Terminal
end # TTY