1
當Ruby執行行puts "#{number}..."
,
爲什麼它不知道那裏的數字應該是一個變量?
它試圖執行self.number方法變量定義在塊
class Roulette
def method_missing(name, *args)
person = name.to_s.capitalize
3.times do
number = rand(10) + 1
puts "#{number}..."
end
"#{person} got a #{number}"
end
end
number_of = Roulette.new
puts number_of.bob