I'm a Ruby newbie. I'm using TexMate Version 1.5.9 (1510) on Mac OS X Version 10.6.4. I'm trying to write a small Ruby snippet to get keyboard input as follows:

puts "What is your name? "
name = gets.chomp
puts "Hello #{name}"

I get the following TextMate error:

NoMethodError: private method ‘chomp’ called for nil:NilClass

at top level

in sayhello.rb at line 2

Program exited with code #1 after 0.02 seconds.


I've googled pretty much every piece of information on Ruby keyboard input, changed that little snippet many times accordingly, but I could never get it to work. 


I realize that this question is not directly related to TextMate, but I'm hoping somebody can help me.


Thanks in advance,


Marc