2015-06-17 70 views
0

無法找出ruby koans這一個。也許有人可以幫忙? The answers you seek... undefined method to_a_shuffle」爲1..5:範圍紅寶石koans shuffle發生了什麼

請在下面的代碼默想: /Users/nicholaskelly/koans/koans/about_dice_project.rb:12:in roll' /Users/nicholaskelly/koans/koans/about_dice_project.rb:24:in test_rolling_the_dice_returns_a_set_of_integers_between_1_and_6'`

,這裏是about_dice_project .rb12:

@values = (1..number).to_a_shuffle 

回答

2

沒有名爲to_a_shuffle的方法。您需要將to_a應用於範圍然後shuffle該數組。

@values = (1..number).to_a.shuffle 
+0

謝謝! @Amit – reivax7