From: Brian Candler Date: 2010-07-15T05:55:04+09:00 Subject: Re: trouble waiting X minutes Tee Dubb wrote: > below is the code that's not > working. Your program doesn't have any threads, so it will execute in lock-step. That is, when you enter pass, you will sleep for 60 seconds there, before returning. Try adding some puts statements to see what's going on, e.g. > class Test > > def initialize puts "start initialize" > @junk = Array.new > @opensocket = TCPSocket.new('localhost', 8080) puts "socket open" > read puts "read has returned, done initialize" > end > > def read puts "start read" > while @lines = @opensocket.gets > FasterCSV.parse(@lines) do |@row| puts "Read line #{@row.inspect}, going to pass" > pass puts "pass has returned" > end > end puts "done read" > end > > def pass puts "starting pass" > @junk << @row puts "sleeping for 60..." > sleep(60) > p @junk > end > end > > enable = Test.new You could alternatively try to use a debugger to single-step the program, but generally I find the hassle of learning to drive the debugger to be higher than putting the debug statements in. -- Posted via http://www.ruby-forum.com/.