0

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.

KhoaVo
  • 376
  • 3
  • 18
  • 1
    Just tested, same error here. No idea for solving it, but anyway, Sublime Text output console does not accept text input so even if you could make it work, you'll be stuck anyway - user input can't be tested inside the editor. – Martin Dec 31 '15 at 08:36
  • I guess it's related with sublime limitations for ruby. For python user input works fine. – PatNowak Dec 31 '15 at 08:48
  • @PatNowak no it doesn't. You can't use `raw_input` or `input` with Sublime without [`SublimeREPL`](https://packagecontrol.io/packages/SublimeREPL). – MattDMo Dec 31 '15 at 17:28

0 Answers0