Sha256: 59b41dbc72bc4a35ee4a065ca65bbae5a5b79610696e38243185fe3969220b64
Contents?: true
Size: 547 Bytes
Versions: 3
Compression:
Stored size: 547 Bytes
Contents
module Hands class Deck # @return [Array] {Card}s in the {Deck} attr_reader :cards # Initialize the deck with 52 {Card}s def initialize @cards = [] VALUES.each do |value| SUITS.each do |suit| @cards << Card[value, suit] end end end # Shuffle the {Deck} def shuffle! @cards.shuffle! end # Pop a card off the {Deck} # @return [Card] the {Card}(s) popped off the {Deck} def pop(number_of_cards = 1) @cards.pop(number_of_cards) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hands-0.3.0 | lib/hands/deck.rb |
hands-0.2.1 | lib/hands/deck.rb |
hands-0.2.0 | lib/hands/deck.rb |