Sha256: 6ab9552d2dc246d9479888906540bcb9aaf4ce78a765cd32d1a79660a9d1ed89

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

# Methods common to all backend impls
class IO
  def getch(*)
    raw do
      getc
    end
  end

  def getpass(prompt = nil)
    wio = self == $stdin ? $stderr : self
    wio.write(prompt) if prompt
    begin
      str = nil
      noecho do
        str = gets
      end
    ensure
      puts($/)
    end
    str.chomp
  end

  module GenericReadable
    def getch(*)
      getc
    end

    def getpass(prompt = nil)
      write(prompt) if prompt
      str = gets.chomp
      puts($/)
      str
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
io-console-0.5.7-java jruby/io/console/common.rb