不让我使用。包括吗?(尝试编写ruby游戏)
我正在尝试编写一个基于文本的ruby游戏,但我不知道什么不允许我的代码使用.includes?方法 以下是我遇到的错误:不让我使用。包括吗?(尝试编写ruby游戏),ruby,include,nomethoderror,Ruby,Include,Nomethoderror,我正在尝试编写一个基于文本的ruby游戏,但我不知道什么不允许我的代码使用.includes?方法 以下是我遇到的错误: game.rb:31:in `home': undefined method `includes?' for "run":String (NoMethodError) from game.rb:20:in `call' from game.rb:20:in `play' from game.rb:69:in `<main>' 我的其他文件
game.rb:31:in `home': undefined method `includes?' for "run":String (NoMethodError)
from game.rb:20:in `call'
from game.rb:20:in `play'
from game.rb:69:in `<main>'
我的其他文件levels.rb如下:
module Levels
def prompt
puts
print " > "
end
def die(why)
puts
puts " #{why} #{@quips[rand(@quips.length)]}"
Process.exit(1)
end
def bad_input
puts <<-TEXT
Learn to follow instructions!
TEXT
return :die
end
def home_text
puts <<-TEXT
You wake up to the smell of smoke in your room. Jolting up from your bed, you
look around the room and see a heavy cloud of smoke covering your ceiling. There
are piercing sounds of screaming outside, coupled with terrorizing roars and howls.
TEXT
end
end
模块级别
def提示符
放
打印“>”
结束
def模具(为什么)
放
放置“{why}{@quips[rand(@quips.length)]”
进程。退出(1)
结束
def坏_输入
将您拥有的包含?
放入您的代码中。方法是包含?
(否)
module Levels
def prompt
puts
print " > "
end
def die(why)
puts
puts " #{why} #{@quips[rand(@quips.length)]}"
Process.exit(1)
end
def bad_input
puts <<-TEXT
Learn to follow instructions!
TEXT
return :die
end
def home_text
puts <<-TEXT
You wake up to the smell of smoke in your room. Jolting up from your bed, you
look around the room and see a heavy cloud of smoke covering your ceiling. There
are piercing sounds of screaming outside, coupled with terrorizing roars and howls.
TEXT
end
end