Class: Brigitte::Deck
- Inherits:
-
Object
- Object
- Brigitte::Deck
- Defined in:
- lib/brigitte/deck.rb
Overview
A Deck generates and shuffles all cards except Joker. Joker is not used in Brigitte
Constant Summary collapse
- SIGNS =
%w[♣ ♦ ♥ ♠].freeze
- PREFIX =
%w[2 3 4 5 6 7 8 9 10 J Q K A].freeze
Instance Attribute Summary collapse
-
#cards ⇒ Object
Returns the value of attribute cards.
Instance Method Summary collapse
-
#initialize ⇒ Deck
constructor
A new instance of Deck.
Constructor Details
#initialize ⇒ Deck
Returns a new instance of Deck.
13 14 15 16 17 |
# File 'lib/brigitte/deck.rb', line 13 def initialize @cards = PREFIX.map do |prefix| SIGNS.map { |sign| Card.new(prefix, sign) } end.flatten.shuffle end |
Instance Attribute Details
#cards ⇒ Object
Returns the value of attribute cards.
8 9 10 |
# File 'lib/brigitte/deck.rb', line 8 def cards @cards end |