cards_lib 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40686980c91619c8ef3bb32e4e588ac6aad753bd
4
- data.tar.gz: 83b9ae9a10145ff9645e69a7c384bb76b7edb8c9
3
+ metadata.gz: 27b41260f30a649a682facf503c2b7affcd03ee9
4
+ data.tar.gz: 5540fb1936dc356312778adc2bd1bf6838c59e53
5
5
  SHA512:
6
- metadata.gz: b6d5ab265159385f58c1ee7c213260f6c83bb8ded6448d8f8ff0f90433f8233a7f7dc23ab564991409ab7b8b805fdc0402732266c67991bc2b3f662265e83f9f
7
- data.tar.gz: 1f830281cea4d85741e25596f48884dd4469589eed84e2da52dbc1d8e25b778dca4d5d245d0584c64abd39c0bd7b0babd31cf0bfbe4e0143371392f3debb456b
6
+ metadata.gz: 67d11e2507051f32b4c56faa8c692b05feb713b8779b68f82a40fb0e56f53450a3dbbc9f0579c7c46a1ce7a558854edb7a49edcf1fa4fc4907e61dea162e0408
7
+ data.tar.gz: bb7d3ee9f17ad5ab2456da4295783904f083c559a3ddacd8247b800c25404a8d069c9e7b802505a6e6f39b170a47af399fd169143667bacadc2107f3236233bb
data/README.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/cards_lib.svg)](http://badge.fury.io/rb/cards_lib)[![Build Status](https://travis-ci.org/danielpclark/CardsLib.svg?branch=master)](https://travis-ci.org/danielpclark/CardsLib)[![Code Climate](https://codeclimate.com/github/danielpclark/CardsLib/badges/gpa.svg)](https://codeclimate.com/github/danielpclark/CardsLib)[![Test Coverage](https://codeclimate.com/github/danielpclark/CardsLib/badges/coverage.svg)](https://codeclimate.com/github/danielpclark/CardsLib/coverage)
4
4
 
5
+ I apply best practices in designing this gem and each feature has had
6
+ a LOT of thought put into it. Just look at how the Deck works. It's
7
+ designed with an immutable set of cards to draw from and to return
8
+ cards to. You can even seed it to write robust tests and get the same
9
+ results time after time. Card evaluation is written in a functional
10
+ way that allows, and is optimized for, lazy evaluation. The set
11
+ verification is as simple as handing it some cards and the names of
12
+ the rules to apply.
13
+
14
+ I'm willing to bet you that there is no other Ruby card game library
15
+ out there as easy to use, as well thought out, and as simple to
16
+ understand as mine. Come on, I dare you to use it and review it! ;-)
17
+
18
+
5
19
  ##Install
6
20
 
7
21
  ```
@@ -43,9 +57,11 @@ CardsLib::IsSet.verify(
43
57
 
44
58
  ##Goodies
45
59
 
46
- * lib/cards_lib/is_set.rb is a golden tool in card hand verification.
47
- * In lib/cards_lib/standard.rb there are some basic deck templates.
48
- * In lib/cards_lib/standard/rules/poker.rb there are some working Poker hand verification methods.
60
+ * **lib/cards_lib/is_set.rb** is a golden tool in card hand verification.
61
+
62
+ * In **lib/cards_lib/standard.rb** there are some basic deck templates.
63
+
64
+ * In **lib/cards_lib/standard/rules/poker.rb** there are some working Poker hand verification methods.
49
65
 
50
66
  ##License
51
67
 
@@ -53,21 +53,22 @@ module CardsLib
53
53
  def ordered?(other)
54
54
  self.sequential?(other) ? other : nil
55
55
  end
56
- end
57
56
 
58
- class InvalidCardFace < Exception; end
59
- class InvalidRankAndSuit < Exception; end
57
+ private
58
+ def face_from_rank_and_suit(rank, suit)
59
+ if rank && suit
60
+ [rank, ((rank.length.>(1) && suit.length.>(1)) ? " of " : ""), suit].join
61
+ else
62
+ raise InvalidRankAndSuit, "Suit and Rank provided in Hash are invalid!"
63
+ end
64
+ end
60
65
 
61
- private
62
- def face_from_rank_and_suit(rank, suit)
63
- if rank && suit
64
- [rank, ((rank.length.>(1) && suit.length.>(1)) ? " of " : ""), suit].join
65
- else
66
- raise InvalidRankAndSuit, "Suit and Rank provided in Hash are invalid!"
66
+ def if_hash_then_fetch(item, target)
67
+ item.is_a?(Hash) ? item.fetch(target) { nil } : nil
67
68
  end
68
- end
69
69
 
70
- def if_hash_then_fetch(item, target)
71
- item.is_a?(Hash) ? item.fetch(target) { nil } : nil
72
70
  end
71
+
72
+ class InvalidCardFace < Exception; end
73
+ class InvalidRankAndSuit < Exception; end
73
74
  end
@@ -1,3 +1,3 @@
1
1
  module CardsLib
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cards_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark