Question on a card game I'm making

I have a series of cards as classes. My deck class will generate a .new
version of all the cards a certain number of times to populate the deck
with cards. My player class then accesses the deck with .sample and
pushes them into an array called player_hand of size 5. The problem I’m
stuck on is finding a good way to display all of the card
information(atk, def, type, name, hp) to the player by expanding each
cards “traits” that they are currently holding in @player_hand.


class Player
include Battle
attr_accessor :player_hp, player_hand

def initialize(player_hp=P_MAX_HP)
@player_hp = player_hp
@player_name = player_name
@player_hand = player_hand[]


def get_player_name
@player_name = gets.chomp

def alive?(player_hp)
@playerhp > 0

def new_hand
new_hand =
5.times do new_hand.push(@@deck.sample); end
@player_hand = new_hand

def draw
until @player_hand.size == 5
def inspect_card

Here’s some example cards(for now we will use 3) id like to display:

class FireBunny < Card
traits :atk, :defense, :type, :num, :hp
atk 4
defense 2
type “fire”
num 1
hp 10

class WaterBug < Card
traits :atk, :defense, :type, :num, :hp
atk 2
defense 4
type “water”
num 2
hp 14

class LandWorm < Card
traits :atk, :defense, :type, :num, :hp
atk 3
defense 3
type “land”
num 3
hp 12

(pardon my silly names)

After they are in the array, i will have to write a display method
corresponding to the cards by making the player type 1 , 2 , 3 , 4 , 5
for each card in their hand. my only question is is how to display their

I can’t see from this code how you’re holding each card’s attributes,
but the simplest way would be to store them in a Hash and then display
the Hash.