card_deck 1.1.0 → 1.2.0

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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/card_deck.rb +12 -3
  3. metadata +18 -4
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmI0YTQ2YjRmZjIwMDMyYTE2YzQzMzY4ZTA4OGQxYTVhMjJhOGE0MA==
4
+ Mzg2NTIwZjhkNTg2NTgwZDJkZjc4ZjY5ZjU2MDU4YjYyNjRmZmJkNg==
5
5
  data.tar.gz: !binary |-
6
- MjM2MDUyMjlkMTJiMjNlZjgyN2NiMWY2ZmM0NGNjYzQxY2VhOGEwMA==
6
+ NWZlN2IxODc1ZjIyZWUyODNlYWE1NmRhZmM0M2Q5NmRiYjIyYzc2OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGZjMTE4NzdjYWU4NDkzYmZiN2RhOTQ4NTQ2NTgyYWI4YjRhMjI2Y2Q4NDA3
10
- OTE4ZDk1NDI3MTY0NmNlMGY3YTUwMTJhMWVjZjdmZjA2ODFkN2NjYzdkMzkz
11
- MzZiOTE5MDEwYjk4ZmE0ZDI1ZWRhZWU0ODA5N2NmOGE4Y2JiZmM=
9
+ ZTEyNmFlNDAwZmU3MzEyZWIxN2QyMjZhNzhlOWI4OGVlZDJmMWVjNjI5Mjkw
10
+ ZjZlZDhiODM4NDVhYTQ2MjViN2YxN2E2NGQ4N2UxNDM2OWRhNDRiZTc3YTAw
11
+ ZjNjNDc3YTY4OTc1NDg5Y2EzMWMyMzM5NmU0M2M4ODZkOWQ1ZjU=
12
12
  data.tar.gz: !binary |-
13
- NDNkMTJkNGQyZDUzYjcxZWY3MGQ1N2Y0MjAxZTNhZDFhN2VlMWRjZjI2Nzhk
14
- OTVlY2I2MTExNDQxYmU0ZDk2MzY0Y2EzYWIwYjA1ODRiMzRjNjIxMjk3YmEx
15
- Y2JmYTgyMWRjYWIzNzgxZTY3ZTI1NTkxZTczYzdhMjg5MmFjYzU=
13
+ NzlkOWZmNzIzYzAxNjg1MmFhYzA3M2ZhYmE4NzExY2E5OTEwM2QwMjY5OTEz
14
+ M2Q5NzgxNmNlNzFjMjIyMmRkZjUwMTRlYjgyZmMxNTlmNTFmNzhjYTIxOTEx
15
+ YWZmMWJkMDczOTk3MDNlZWY3NTdmZjg2ZWRhMmEwMTRiOTJiYTg=
data/lib/card_deck.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # The gem
2
2
  module CardDeck
3
- # Gem Version
4
- VERSION = "1.0.1"
3
+ def Card(num, suit=nil) # an easier way to generate a card
4
+ Card.new num, suit
5
+ end
5
6
  # Errors for when you incorrectly use a card.
6
7
  class CardError < StandardError; end
7
8
  class Card # The central part of any card game. It is what makes card games 'Card' games.
@@ -17,6 +18,14 @@
17
18
  attr_accessor :suit
18
19
  # Creates a new card. Parameter num is the card's number. Parameter suit is the card's suit
19
20
  def initialize(num, suit=nil)
21
+ unless suit.nil?
22
+ suit = case suit.downcase
23
+ when "diamonds" then DIAMONDS
24
+ when "spades" then SPADES
25
+ when "hearts" then HEARTS
26
+ when "clubs" then CLUBS
27
+ end
28
+ end
20
29
  unless NUM.include?(num) || SUIT.include?(suit) || suit.nil?
21
30
  raise CardError, 'Illegal argument'
22
31
  else
@@ -26,7 +35,7 @@
26
35
  def self.gen # Creates a random new card.
27
36
  self.new NUM.sample, SUIT.sample
28
37
  end
29
- def abbreviation # The short version of the card
38
+ def abbreviation # The shorter representation of the card
30
39
  unless @num == "Joker"
31
40
  if @num == 10 then "#{@suit}#{@num}"
32
41
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card_deck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Perlmutter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-its
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Supplies the core parts of any card game. To use the deck, call shuffle
28
42
  on it.
29
43
  email: zrp200@gmail.com