[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Stupid Ruby Tricks

Chris Carter

12/31/2006 2:46:00 AM

Hey guys,
To try out this "post blog articles to the list, maybe insight some
discussion" idea, I offer the community this. I maintain the "Stupid
Ruby Tricks" wiki over at http://... and I recently compiled a
bit of a "best of". Check it!
http://concentrationstudios.com/2006/12/20/12-days-of-stupid-r...

--
Chris Carter
concentrationstudios.com
brynmawrcs.com

2 Answers

Jacob, Raymond A Jr

12/31/2006 5:06:00 AM

0

Firstly, I appologize if this question has already been answered but I could not figure out the
correct way to word my search on google to find anything relevant. I am running Ruby 1.8.2-15
on windows XP. I used the one-click version.
I am trying to write a script that will prompt a user for a password and not echo the characters back to screen.
Is this possible in the dos command window? If so then please give me a reference else is there an alternative
such as using TK?

thank you,
raymond

James Gray

12/31/2006 3:22:00 PM

0

On Dec 30, 2006, at 11:56 PM, Jason Mayer wrote:

> On 12/30/06, Jacob, Raymond A Jr <raymond.jacob@navy.mil> wrote:
>>
>> Firstly, I appologize if this question has already been answered
>> but I
>> could not figure out the
>> correct way to word my search on google to find anything relevant.
>> I am
>> running Ruby 1.8.2-15
>> on windows XP. I used the one-click version.
>> I am trying to write a script that will prompt a user for a
>> password and
>> not echo the characters back to screen.
>> Is this possible in the dos command window? If so then please
>> give me a
>> reference else is there an alternative
>> such as using TK?
>>
>> thank you,
>> raymond
>>
>>
> page 791 and 792 of the ruby cookbook covers this.
>
> require 'rubygems'
> require 'highline/import'
>
> def get_password(prompt='Password: ')
> ask(prompt) { |q| q.echo = false}
> end
>
> get_password("What's your password?")

Or just:

require "rubygems"
require "highline/import"

ask("Password: ") { |q| q.echo = false }

__END__

;)

James Edward Gray II