class PokerEngine::Card

Constants

COLORS
RANKS

Attributes

color[R]
rank[R]

Public Class Methods

french_deck() click to toggle source
# File lib/poker_engine/card.rb, line 6
def self.french_deck
  Card::RANKS
    .product(Card::COLORS.values)
    .map { |rank, color| Card.new rank, color }
end
new(rank, color) click to toggle source
# File lib/poker_engine/card.rb, line 14
def initialize(rank, color)
  @rank = rank
  @color = color
end

Public Instance Methods

to_s() click to toggle source
# File lib/poker_engine/card.rb, line 23
def to_s
  "#{@rank}#{@color[0]}"
end
value() click to toggle source
# File lib/poker_engine/card.rb, line 19
def value
  @value ||= RANKS.index rank
end