class RubyPlayingCards::Deck
Constants
- SUITS
Attributes
cards[RW]
Public Class Methods
new()
click to toggle source
# File lib/ruby_playing_cards/deck.rb, line 11 def initialize @cards = [] build_deck end
Public Instance Methods
size()
click to toggle source
# File lib/ruby_playing_cards/deck.rb, line 16 def size @cards.size end
to_s()
click to toggle source
# File lib/ruby_playing_cards/deck.rb, line 20 def to_s @cards.map do |card| "#{card.suit}#{card.rank}" end end
Private Instance Methods
build_deck()
click to toggle source
# File lib/ruby_playing_cards/deck.rb, line 28 def build_deck SUITS.each do |suit| 1.upto(13) do |rank| @cards << Card.new(rank, suit) end end end