ruby_playing_cards 0.0.1 → 0.0.2
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/lib/ruby_playing_cards/card.rb +3 -2
- data/lib/ruby_playing_cards/deck.rb +5 -5
- data/lib/ruby_playing_cards/version.rb +1 -1
- data/spec/card_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a50ed58d11872987b68f158ca52470ba32ebbe20
|
4
|
+
data.tar.gz: e3e7146be1fcd6a963d7e9d583251b02c8412715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e4cbe987be5bf1528d558f193b656a1287b2cbf0b3d3b82ff7b01fd9331730a7ef02c5e21966c6197d7453e360d9d601aa5583c9a7a79f0a7f4e142d7901571
|
7
|
+
data.tar.gz: 6fc6d556accc5cf620204048763beb66fdd9e0c3796c902097346d6e31bee6c96c391c2f8ad3135cd925305601e48879dd50729856a821ea74c2d8fac58a5341
|
@@ -3,15 +3,16 @@ module RubyPlayingCards
|
|
3
3
|
class Card
|
4
4
|
|
5
5
|
FACE_CARDS = { 1 => :A, 13 => :K, 12 => :Q, 11 => :J }
|
6
|
-
attr_accessor :rank, :suit
|
6
|
+
attr_accessor :rank, :suit, :value
|
7
7
|
|
8
8
|
def initialize(rank, suit)
|
9
|
+
@value = rank
|
9
10
|
@rank = FACE_CARDS[rank] || rank
|
10
11
|
@suit = suit
|
11
12
|
end
|
12
13
|
|
13
14
|
def to_s
|
14
|
-
"#{@suit}#{@rank}"
|
15
|
+
"#{@suit[:icon].to_s}#{@rank}"
|
15
16
|
end
|
16
17
|
|
17
18
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module RubyPlayingCards
|
2
2
|
class Deck
|
3
3
|
SUITS = [
|
4
|
-
{ name: :spades, icon:
|
5
|
-
{ name: :
|
6
|
-
{ name: :
|
7
|
-
{ name: :
|
4
|
+
{ name: :spades, icon: :♠, color: :black },
|
5
|
+
{ name: :clubs, icon: :♣, color: :black },
|
6
|
+
{ name: :hearts, icon: :♥, color: :red },
|
7
|
+
{ name: :diamonds, icon: :♦, color: :red }
|
8
8
|
]
|
9
9
|
attr_accessor :cards
|
10
10
|
|
@@ -28,7 +28,7 @@ module RubyPlayingCards
|
|
28
28
|
def build_deck
|
29
29
|
SUITS.each do |suit|
|
30
30
|
1.upto(13) do |rank|
|
31
|
-
@cards << Card.new(rank, suit
|
31
|
+
@cards << Card.new(rank, suit)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/spec/card_spec.rb
CHANGED
@@ -5,7 +5,7 @@ RSpec.describe RubyPlayingCards::Card do
|
|
5
5
|
describe 'when creating cards' do
|
6
6
|
it 'should show card' do
|
7
7
|
for val in 2...10 do
|
8
|
-
card = RubyPlayingCards::Card.new(val, 'suit')
|
8
|
+
card = RubyPlayingCards::Card.new(val, {:icon => 'suit'})
|
9
9
|
expect(card.to_s).to eq("suit#{val}")
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_playing_cards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin McKay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Basic playing cards
|
14
14
|
email:
|