sublime text can't compile gets.chomp

83 Views Asked by At

I'm learning ruby on sublime text 2, however it seems that sublime text cannot understand user input method.

when I typed

puts "Enter your first name: "
first_name = gets.chomp 

sublime text return this error:

in `<main>': undefined method `chomp' for nil:NilClass (NoMethodError)

I used a custom Ruby build system with the correct file path to ruby.

{
    "cmd": ["/Users/KhoaVo/.rvm/bin/rvm-auto-ruby", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.ruby"
}

I was wondering if anyone encountered the same error, if so, how did you fix the error? By the way, the entire ruby code consists of only those 2 lines above.

0

There are 0 best solutions below