Skip to content

Instantly share code, notes, and snippets.

@justuseapen
Created November 26, 2013 14:47
Show Gist options
  • Save justuseapen/7659547 to your computer and use it in GitHub Desktop.
Save justuseapen/7659547 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
if rank.nil?
@rank = [2..10,'J','Q','K','A'].sample
puts "Create a new card: #{@rank} of #{@suit}"
end
end
5.times { Card.new('10') }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment