From: Robert Klemme on 21 Nov 2009 11:48
On 20.11.2009 18:14, Aldric Giacomoni wrote:
> Brian Candler wrote:
>> if gets.chomp! == "!quit" then
>> puts gets.chomp!
>> Note how gets is called twice.
> Also, I have a question...
> results = select([@sock, STDIN], nil, nil)
> for input in results
> end #for
> end #if
> Instead of doing a for loop - just do "results.each", which is more
Absolutely. Usually one would do
ios = [... ]
in, = select(ios)
in.each do |io|
data = io.read_nonblock 1024
> The question is, what does "select" do ? rdocs aren't helpful, and I
> don't understand that bit of code.
See Brian's explanation.
remember.guy do |as, often| as.you_can - without end