Sha256: a6674d8a1c3f0b4e79feec8178176374de10c3c1e3559771d3c61cb93ac4384a

Contents?: true

Size: 531 Bytes

Versions: 6

Compression:

Stored size: 531 Bytes

Contents

# Methods common to all backend impls
class IO
  def getch(*, **opts)
    raw(**opts) 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

6 entries across 6 versions & 1 rubygems

Version Path
io-console-0.7.1-java lib/ffi/io/console/common.rb
io-console-0.7.0-java lib/ffi/io/console/common.rb
io-console-0.6.0-java lib/io/console/ffi/common.rb
io-console-0.5.11-java lib/io/console/ffi/common.rb
io-console-0.5.9-java lib/io/console/ffi/common.rb
io-console-0.5.8-java lib/io/console/ffi/common.rb