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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1bf2e0a631db30fd8497e9be093449ff9c17e7c
4
- data.tar.gz: e0ec451f9ead125e7a1be66fb1f7d70f5ab9f3f8
3
+ metadata.gz: a50ed58d11872987b68f158ca52470ba32ebbe20
4
+ data.tar.gz: e3e7146be1fcd6a963d7e9d583251b02c8412715
5
5
  SHA512:
6
- metadata.gz: c1073abf1c671845068b5e2c249340a06a358bda91c6550ce2a2687d1db89804bd4472f9c7cff32cbbf0374d8716eea725502f88766ec937d24ab5dbfcf75f91
7
- data.tar.gz: c3568f1dc59f6d621cd4b39e1b2628c1418df60cc18b1491ad4e9d0e9623ea2210bd9ea49116088cd29b914f2e46d5fc03c460344909181a3f206a7b710121e7
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: :hearts, icon: :♥},
6
- { name: :diamonds, icon: :♦},
7
- { name: :clubs, icon: :♣}
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[:icon])
31
+ @cards << Card.new(rank, suit)
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module RubyPlayingCards
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  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.1
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-06 00:00:00.000000000 Z
11
+ date: 2017-06-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Basic playing cards
14
14
  email: