require 'cardshark'
class Deck < Cardshark::Deck; end
class Card < Cardshark::Card; end
class Rank < Cardshark::Dimension; end
class Suit < Cardshark::Dimension; end
ranks = [
:ace,
:two,
:three,
:four,
:five,
:six,
:seven,
:eight,
:nine,
:ten,
:jack,
:queen,
:king
].each do |name|
Rank.new(name)
end
suits = [
:clubs,
:diamonds,
:hearts,
:spades
].each do |name|
Suit.new(name)
end
deck = Deck.new do
cards = []
Suit.all.each do |suit|
Rank.all.each do |rank|
cards << Card.new(rank, suit)
end
end
cards
end
ahmed1231234 / cardshark Goto Github PK
View Code? Open in Web Editor NEWThis project forked from johndbritton/cardshark
Ruby gem for representing different decks of cards... work in progress
License: MIT License