class SimplePlayingCards::Deck
Attributes
cards[RW]
options[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/simple_playing_cards/deck.rb, line 4 def initialize(options = {}) @cards = [] @options = options build_deck end
Public Instance Methods
deal(amount)
click to toggle source
# File lib/simple_playing_cards/deck.rb, line 10 def deal(amount) cards.shift(amount) end
shuffle()
click to toggle source
# File lib/simple_playing_cards/deck.rb, line 14 def shuffle cards.shuffle! end
Private Instance Methods
build_deck()
click to toggle source
# File lib/simple_playing_cards/deck.rb, line 20 def build_deck Card::SUITS.each do |suit| Card::RANKS.each do |rank| cards << Card.new(rank, suit, options) end end end