Class: CardDeck::Deck
- Inherits:
-
Object
- Object
- CardDeck::Deck
- Defined in:
- lib/deck.rb
Overview
The deck
Instance Attribute Summary collapse
-
#cards ⇒ Object
The cards in the deck.
Instance Method Summary collapse
-
#initialize(args = Hash.new(false)) ⇒ Deck
constructor
Creates a new Deck.
Constructor Details
#initialize(args = Hash.new(false)) ⇒ Deck
Creates a new Deck. Includes Jokers when parmeter args == true
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/deck.rb', line 5 def initialize(args=Hash.new(false)) # Creates a new Deck. Includes Jokers when parmeter args == {jokers: true} @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 args[:jokers] end |
Instance Attribute Details
#cards ⇒ Object
The cards in the deck
4 5 6 |
# File 'lib/deck.rb', line 4 def cards @cards end |