1
我对ruby真的很陌生,我正在尝试做一个即将到期的项目。如何在ruby中调用成员变量的成员函数?
我得到了错误"undefined method 'new_round' for nil:NilClass"
,并不知道发生了什么。希望有人会帮助我。非常感谢。
class Blackjack
def initialize()
@deck = Deck.new(gets.to_i())
@dealer = Dealer.new()
@players = []
end
def new_round()
end
end
class Controller
def initializer()
@blackjack = Blackjack.new()
end
def run()
loop do
@blackjack.new_round()
end
end
end
Controller.new().run()