Skip to content

Instantly share code, notes, and snippets.

@laurenkruczyk
Created March 3, 2014 16:53
Show Gist options
  • Save laurenkruczyk/9329226 to your computer and use it in GitHub Desktop.
Save laurenkruczyk/9329226 to your computer and use it in GitHub Desktop.
class Card
def initialize(rank = nil, suit = nil)
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
@rank = rank
if rank.nil?
@rank= ["jack", "king", "queen", "ace"].sample
else
@rank=rank
end
puts "Create a new card: #{@rank} of #{@suit}"
end
end
5.times { Card.new }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment