Class: RubyPlayingCards::Deck
- Inherits:
-
Object
- Object
- RubyPlayingCards::Deck
- Defined in:
- lib/ruby_playing_cards/deck.rb
Constant Summary collapse
- SUITS =
[ { name: :spades, icon: :
Instance Attribute Summary collapse
-
#cards ⇒ Object
Returns the value of attribute cards.
Instance Method Summary collapse
-
#initialize ⇒ Deck
constructor
A new instance of Deck.
- #size ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Deck
Returns a new instance of Deck.
11 12 13 14 |
# File 'lib/ruby_playing_cards/deck.rb', line 11 def initialize @cards = [] build_deck end |
Instance Attribute Details
#cards ⇒ Object
Returns the value of attribute cards.
9 10 11 |
# File 'lib/ruby_playing_cards/deck.rb', line 9 def cards @cards end |
Instance Method Details
#size ⇒ Object
16 17 18 |
# File 'lib/ruby_playing_cards/deck.rb', line 16 def size @cards.size end |
#to_s ⇒ Object
20 21 22 23 24 |
# File 'lib/ruby_playing_cards/deck.rb', line 20 def to_s @cards.map do |card| "#{card.suit}#{card.rank}" end end |