Created
December 16, 2014 14:16
-
-
Save bradyswenson/9a61012e73b7edf4da9a to your computer and use it in GitHub Desktop.
var scope question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: /Users/bradyswenson/tealeaf/tealeaf-1-lesson-2/blackjack.rb @ line 267 Blackjack#play: | |
262: | |
263: if player.money == 0 | |
264: puts "You've lost everything." | |
265: break | |
266: elsif deck.size < 15 | |
=> 267: binding.pry | |
268: deck = Deck.new | |
269: binding.pry | |
270: puts "Time for a new deck..." | |
271: sleep (2.2) | |
272: end | |
[1] pry(#<Blackjack>)> deck.size | |
NoMethodError: undefined method `size' for nil:NilClass | |
from (pry):1:in `play' | |
[2] pry(#<Blackjack>)> deck | |
=> nil | |
[4] pry(#<Blackjack>)> self.deck | |
=> #<Deck:0x00000103296400 | |
@cards= | |
[#<Card:0x00000103296040 @suit="♠", @value="5">, | |
#<Card:0x00000103295ed8 @suit="♠", @value="A">, | |
#<Card:0x00000103295708 @suit="\e[31m♦\e[0m", @value="10">, | |
#<Card:0x000001032956b8 @suit="\e[31m♦\e[0m", @value="Q">, | |
#<Card:0x00000103295c30 @suit="\e[31m♥\e[0m", @value="4">, | |
#<Card:0x000001032953e8 @suit="♣", @value="3">, | |
#<Card:0x00000103295f00 @suit="♠", @value="K">, | |
#<Card:0x00000103295af0 @suit="\e[31m♥\e[0m", @value="Q">, | |
#<Card:0x000001032957d0 @suit="\e[31m♦\e[0m", @value="5">, | |
#<Card:0x00000103295848 @suit="\e[31m♦\e[0m", @value="2">, | |
#<Card:0x00000103296090 @suit="♠", @value="3">]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment