Class: CardDeck::Deck
- Inherits:
-
Object
- Object
- CardDeck::Deck
- Defined in:
- lib/card_deck.rb
Overview
Card decks
Instance Attribute Summary collapse
-
#cards ⇒ Object
The cards in the deck.
Instance Method Summary collapse
-
#initialize(jokers = false) ⇒ Deck
constructor
Creates a new Deck.
Constructor Details
#initialize(jokers = false) ⇒ Deck
Creates a new Deck. Includes Jokers when parameter jokers = true
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/card_deck.rb', line 43 def initialize(jokers=false) @cards = Array.new for suit in Card::SUIT stock 'Ace', suit for num in (2..10).to_a; stock num, suit; end stock 'Jack', suit stock 'Queen', suit stock 'King', suit end 2.times {stock 'Joker'} if jokers end |
Instance Attribute Details
#cards ⇒ Object
The cards in the deck
41 42 43 |
# File 'lib/card_deck.rb', line 41 def cards @cards end |