Ruby .include? method is not accepted as a valid method -


i have ruby code in script:

$dev_input=gets.chomp.downcase!     if $dev_input.include? "/"         check_developer_commands()     else         puts ">>invalid command<<"         continuing_dev_mode()     end 

the problem is, whenever try , run script containing this, error spat @ me says :

dev_continue_main.rb:3:in 'continuing_dev_mode': undefined method 'include?' nil:nilclass (nomethoderror) 

any idea error might be? i'm pretty sure proper way use .include? method. i've done research, looked @ tutorialspoint.com , other sites, agree proper way use method.

i checked error message , confirmed third line in script/my example source of problem, it's not other instance of method throwing error.

any thoughts? please help!

the problem $dev_input nil. stems applying downcase! in defining $dev_input. don't know why want possibly assign nil $dev_input, , @ same time claim calling include? on right way. don't intention doing that, if instead had $dev_input = gets.chomp.downcase, wouldn't cause such error.


Comments