Its not the getpass method, but has the same affect using Highline
http://highline.rubyforge.org/

  % cat password.rb
  require "rubygems"
  require "highline/import"

  pass = ask("Enter your password: ") { |q| q.echo = false }
  puts "Your password is [#{pass}]"

  pass = ask("Enter your password: ") { |q| q.echo = '*' }
  puts "Your password is '#{pass}'" 


  % ruby password.rb
  Enter your password: 
  Your password is [iloveruby]
  Enter your password: ***********
  Your password is 'i love ruby'

enjoy,

-jeremy

-- 
========================================================================
 Jeremy Hinegardner                              jeremy / hinegardner.org 


On Fri, Apr 11, 2008 at 01:08:40PM +0900, Yang Zhang wrote:
> Thanks for prompting me to provide some context.  getpass() is a standard 
> POSIX function, described here:
>
> http://www.opengroup.org/pubs/online/7908799/xsh/getpass.html
>
>
> Phillip Gawlowski wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> Yang Zhang wrote:
>> | Hi, how do I do getpass() in ruby? Thanks!
>> def getpass
>> ~  "do getpass()"
>> end
>> Please elaborate on what you mean, and want to do.
>> - --
>> Phillip Gawlowski
>> Twitter: twitter.com/cynicalryan
>> Use data arrays to avoid repetitive control sequences.
>> ~            - The Elements of Programming Style (Kernighan & Plaugher)
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.8 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>> iEYEARECAAYFAkf+1i0ACgkQbtAgaoJTgL870wCeMdCUU+JnWgaWkq1Xx6tqHraN
>> j6kAnjXLAWKYupSM/Z/65oWPvZp+z0AU
>> =blU3
>> -----END PGP SIGNATURE-----
>
>
> -- 
> Yang Zhang
> http://www.mit.edu/~y_z/
>