fiftytwo 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/fiftytwo/has_cards.rb +1 -0
- data/lib/fiftytwo/version.rb +1 -1
- data/spec/lib/fiftytwo/deck_spec.rb +18 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8ac213d7c08c96a46422bd3591200b2ec3a96c52d67b920551147cbaf308d20
|
|
4
|
+
data.tar.gz: 32ed65c3a39a39143e961b1ad700b55722d7a9dcaa8a9060fb14a3ea2bc54ab1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e983105544fa9d9fad75731f31d43024e219512d8da11376657b728e8616348e31d403a2137189741cb1e900fd2fec0651b36733fb8423d706522274cf48817e
|
|
7
|
+
data.tar.gz: 586885d7b1691d9d9d003bbc9e318a21ecdeffae9de70ee6d3b384ece8a51310de31e5ac89614d7122bd2bd225aa90e3b106e504674f2960194352564946d40c
|
data/README.md
CHANGED
|
@@ -132,7 +132,7 @@ your_hand.aces.count
|
|
|
132
132
|
|
|
133
133
|
Pass your cards around:
|
|
134
134
|
```ruby
|
|
135
|
-
my_hand.transfer("4S", your_hand) # try an array of card identifiers, too!
|
|
135
|
+
my_hand.transfer("4S", your_hand) # try an array of card identifiers and/or indexes, too!
|
|
136
136
|
puts my_hand.render, your_hand.render
|
|
137
137
|
# 3♦ 5♦ 7♥ 2♣
|
|
138
138
|
# 5♠ 6♠ 10♦ Q♣ A♦ 4♠
|
data/lib/fiftytwo/has_cards.rb
CHANGED
data/lib/fiftytwo/version.rb
CHANGED
|
@@ -186,20 +186,32 @@ module FiftyTwo
|
|
|
186
186
|
|
|
187
187
|
it "can transfer a card by object" do
|
|
188
188
|
subject.transfer(subject[1], hand)
|
|
189
|
-
expect(subject.
|
|
190
|
-
expect(hand.
|
|
189
|
+
expect(subject.map(&:identifier)).to match_array ["3C", "10D"]
|
|
190
|
+
expect(hand.map(&:identifier)).to match_array ["9D"]
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
it "can transfer a card by identifier" do
|
|
194
194
|
subject.transfer("3C", hand)
|
|
195
|
-
expect(subject.
|
|
196
|
-
expect(hand.
|
|
195
|
+
expect(subject.map(&:identifier)).to match_array ["9D", "10D"]
|
|
196
|
+
expect(hand.map(&:identifier)).to match_array ["3C"]
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it "can transfer a card by index" do
|
|
200
|
+
subject.transfer(0, hand)
|
|
201
|
+
expect(subject.map(&:identifier)).to match_array ["9D", "10D"]
|
|
202
|
+
expect(hand.map(&:identifier)).to match_array ["3C"]
|
|
197
203
|
end
|
|
198
204
|
|
|
199
205
|
it "can transfer multiple cards" do
|
|
200
206
|
subject.transfer(%w[3C 10D], hand)
|
|
201
|
-
expect(subject.
|
|
202
|
-
expect(hand.
|
|
207
|
+
expect(subject.map(&:identifier)).to match_array ["9D"]
|
|
208
|
+
expect(hand.map(&:identifier)).to match_array ["3C", "10D"]
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it "can transfer multiple cards by a variety of identification methods" do
|
|
212
|
+
subject.transfer(["3C", 1], hand)
|
|
213
|
+
expect(subject.map(&:identifier)).to match_array ["10D"]
|
|
214
|
+
expect(hand.map(&:identifier)).to match_array ["3C", "9D"]
|
|
203
215
|
end
|
|
204
216
|
|
|
205
217
|
it "will not transfer any and raise an error if any one card reference is invalid" do
|