Flowdock
method

_gets_noecho

Importance_0
v2_5_5 - Show latest stable - 0 notes - Class: StreamUI
_gets_noecho() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/user_interaction.rb, line 325
  def _gets_noecho
    require_io_console
    if IO.method_defined?(:noecho) then
      @ins.noecho {@ins.gets}
    elsif Gem.win_platform?
      require "Win32API"
      password = ''

      while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
        break if char == 10 || char == 13 # received carriage return or newline
        if char == 127 || char == 8 # backspace and delete
          password.slice!(-1, 1)
        else
          password << char.chr
        end
      end
      password
    else
      system "stty -echo"
      begin
        @ins.gets
      ensure
        system "stty echo"
      end
    end
  end
Register or log in to add new notes.