Rubycards is a library to emulate playing cards (cards, hands, decks). As an added bonus, you can display the cards as tiny pictures. I'm mainly doing this as an exercise to learn better Ruby organization, as well as documentation and testing. More importantly it's just fun.
Feel free to peek around my code and point out anything I'm bad at.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install rubycards
Here's a trivial example of declaring a new deck, shuffling, and drawing 5 cards into a hand:
require 'rubycards' include RubyCards hand = Hand.new deck = Deck.new deck.shuffle! hand.draw(deck, 5) puts hand
Which produces the image at the top of this README.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request