Hi,

I have the following code :

--8<--

require 'press_any_key'
class Game
   def initialize
     ctrlc
   end

   # to accept ctrl-c
   def ctrlc
     trap('INT') do
       print "\r^C received. "
       puts "bybye."
       exit
     end
   end

   def enter_name
     print 'name : '
     name = gets.chomp
   end

   def ready
     PressAnyKey.new
   end
end
player = Game.new
player.enter_name
player.ready

-->8--

The line player.enter_name ; if i do a ctrl-c ; works
The line player.ready ; if i do a ctrl-c ; give me error in `block in 
initialize': Interrupt (Interrupt)

Any idea ?


Thank you very much for your replies.

Cheers,

Nathan.

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>