Class: CardDeck::Deck

Inherits:
Object
  • Object
show all
Defined in:
lib/card_deck.rb

Overview

Card decks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jokers = false) ⇒ Deck

Creates a new Deck. Includes Jokers when parameter jokers = true



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/card_deck.rb', line 49

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

#cardsObject Also known as: inspect

The cards in the deck



46
47
48
# File 'lib/card_deck.rb', line 46

def cards
  @cards
end