card_deck 0.2.1 → 0.2.2.pre.alpha.pre.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +13 -5
  2. data/LICENSE +21 -21
  3. data/README.md +9 -9
  4. data/lib/card_deck.rb +61 -57
  5. metadata +8 -9
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dd7691dfe8a8198b2af07624449f799148a78f0b
4
- data.tar.gz: e860aed43b51d026c1235d039bd97e5d019eb7df
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjgxM2M1Y2NlYjQwOGE4YzgxYjU3ODU1YmQyNDczOTc3ZGE1OTk1Yw==
5
+ data.tar.gz: !binary |-
6
+ ZTc1OGJiNTdhNGFiYmVjMGU0ZDhjYTY4YzQ3ZGExYTYzMjc1ZDEwNQ==
5
7
  SHA512:
6
- metadata.gz: b153f724b90b457e5ebd3e77c4c551f0b701b558d3ed927206ce0d2e282689670c67602195f0228d3b39815b65164a2242117722ccd81df7ef1a4aba76afcdba
7
- data.tar.gz: 7bba989982a40cb920f161a0dd6cc0dd05e2d835cc33dc176257607d32a2b037d2c165b31ec61dce272213a8654395d994f6bb818a741c33c174890788f78772
8
+ metadata.gz: !binary |-
9
+ NWU1Yjk5NDIwNGU5ZDI2OGFiNDc2NTA1MmU1MmU2Njg0YzFiZjEyODNjZWI3
10
+ MTAzZDU2NmQ2ZTFlYzAxYWU1OTEyMDVjMzRmZDIxODdkMDQ5YTg2MTdlOTAz
11
+ NDI2MzdhNTQ1ZmU2MDQ1NDhmYzZhZWE0Y2UxNzBjMjgzYzE4ZGU=
12
+ data.tar.gz: !binary |-
13
+ YmZhMDQzMDc5ZWY0MGU4NTFkOTc0NzFkZjQ5ZTg0NGVjNjBlNGE4ZmI0NzVm
14
+ MjE1M2QzYzc3N2I3OTIwYzEzZjA0MTgxMzkwNDZlMzY1YzM2YmRhMmNkMWYz
15
+ ZTk0ZjdmZThiOTM3MzExNzQwNGRlYWQzMmFhNWQzNWJiZGYzZDU=
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Zachary Perlmutter
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Zachary Perlmutter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # card_deck
2
- The main component of card games
3
-
4
- Can include jokers
5
- ## Badges
6
- [![Gem Version](https://badge.fury.io/rb/card_deck.svg)](http://badge.fury.io/rb/card_deck)
7
- [![Inline docs](http://inch-ci.org/github/zrp200/card_deck.png?branch=master)](http://inch-ci.org/github/zrp200/card_deck)
8
- [![Code Climate](https://codeclimate.com/github/Zrp200/card_deck/badges/gpa.svg)](https://codeclimate.com/github/Zrp200/card_deck)
9
- [![Build Status](https://travis-ci.org/Zrp200/card_deck.svg?branch=master)](https://travis-ci.org/Zrp200/card_deck)
1
+ # card_deck
2
+ The main component of card games
3
+
4
+ Can include jokers
5
+ ## Badges
6
+ [![Gem Version](https://badge.fury.io/rb/card_deck.svg)](http://badge.fury.io/rb/card_deck)
7
+ [![Inline docs](http://inch-ci.org/github/zrp200/card_deck.png?branch=master)](http://inch-ci.org/github/zrp200/card_deck)
8
+ [![Code Climate](https://codeclimate.com/github/Zrp200/card_deck/badges/gpa.svg)](https://codeclimate.com/github/Zrp200/card_deck)
9
+ [![Build Status](https://travis-ci.org/Zrp200/card_deck.svg?branch=master)](https://travis-ci.org/Zrp200/card_deck)
data/lib/card_deck.rb CHANGED
@@ -1,57 +1,61 @@
1
- # The gem
2
- module CardDeck
3
- # Gem Version
4
- VERSION = "0.2.1"
5
- # Errors for when you incorrectly use a card.
6
- class CardError < StandardError; end
7
- class Card # The central part of any card game. It is what makes card games 'Card' games.
8
- # Suits
9
- HEARTS, SPADES, DIAMONDS, CLUBS = "\u2665", "\u2660", "\u2666", "\u2663"
10
- # Legal arguments for parameter num in Card#new.
11
- NUM = %w(Ace King Queen Jack Joker) + (2..10).to_a
12
- # Legal arguments for parameter suit in Card#new
13
- SUIT = [HEARTS, SPADES, DIAMONDS, CLUBS]
14
- # The card's number. Must be Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, or Joker
15
- attr_accessor :num
16
- # The card's suit. Must be Spades, Diamonds, Clubs, Hearts, or nil.
17
- attr_accessor :suit
18
- # Creates a new card. Parameter num is the card's number. Parameter suit is the card's suit
19
- def initialize(num, suit=nil)
20
- unless NUM.include?(num) || SUIT.include?(suit) || suit.nil?
21
- raise CardError, 'Illegal argument'
22
- else
23
- @num, @suit = num, suit
24
- end
25
- end
26
- def abbreviation # The short version of the card
27
- unless @num == "Joker"
28
- "#{@suit}#{(@num.to_s)[0]}"
29
- else
30
- @num
31
- end
32
- end
33
- alias abbr abbreviation # A shorter method name
34
- end
35
- # Card decks
36
- class Deck
37
- # The cards in the deck
38
- attr_accessor :cards
39
- # Creates a new Deck. Includes Jokers when parameter jokers = true
40
- def initialize(jokers=false)
41
- @cards = Array.new
42
- for suit in Card::SUIT
43
- stock 'Ace', suit
44
- for num in (2..10).to_a; stock num, suit; end
45
- stock 'Jack', suit
46
- stock 'Queen', suit
47
- stock 'King', suit
48
- end
49
- 2.times {stock 'Joker'} if jokers
50
- end
51
- private
52
- # Creates a Card to add to Deck#cards
53
- def stock(num, suit=nil)
54
- @cards.push Card.new(num, suit)
55
- end
56
- end
57
- end
1
+ # The gem
2
+ module CardDeck
3
+ # Gem Version
4
+ VERSION = "0.2.2"
5
+ # Errors for when you incorrectly use a card.
6
+ class CardError < StandardError; end
7
+ class Card # The central part of any card game. It is what makes card games 'Card' games.
8
+ # Suits
9
+ HEARTS, SPADES, DIAMONDS, CLUBS = "\u2665", "\u2660", "\u2666", "\u2663"
10
+ # Legal arguments for parameter num in Card#new.
11
+ NUM = %w(Ace King Queen Jack Joker) + (2..10).to_a
12
+ # Legal arguments for parameter suit in Card#new
13
+ SUIT = [HEARTS, SPADES, DIAMONDS, CLUBS]
14
+ # The card's number. Must be Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, or Joker
15
+ attr_accessor :num
16
+ # The card's suit. Must be Spades, Diamonds, Clubs, Hearts, or nil.
17
+ attr_accessor :suit
18
+ # Creates a new card. Parameter num is the card's number. Parameter suit is the card's suit
19
+ def initialize(num, suit=nil)
20
+ unless NUM.include?(num) || SUIT.include?(suit) || suit.nil?
21
+ raise CardError, 'Illegal argument'
22
+ else
23
+ @num, @suit = num, suit
24
+ end
25
+ end
26
+ def abbreviation # The short version of the card
27
+ unless @num == "Joker"
28
+ if @num == 10 then "#{@suit}#{@num}"
29
+ else
30
+ "#{@suit}#{(@num.to_s)[0]}"
31
+ end
32
+ else
33
+ @num
34
+ end
35
+ end
36
+ alias abbr abbreviation # A shorter method name
37
+ alias to_s abbr
38
+ end
39
+ # Card decks
40
+ class Deck
41
+ # The cards in the deck
42
+ attr_accessor :cards
43
+ # Creates a new Deck. Includes Jokers when parameter jokers = true
44
+ def initialize(jokers=false)
45
+ @cards = Array.new
46
+ for suit in Card::SUIT
47
+ stock 'Ace', suit
48
+ for num in (2..10).to_a; stock num, suit; end
49
+ stock 'Jack', suit
50
+ stock 'Queen', suit
51
+ stock 'King', suit
52
+ end
53
+ 2.times {stock 'Joker'} if jokers
54
+ end
55
+ private
56
+ # Creates a Card to add to Deck#cards
57
+ def stock(num, suit=nil)
58
+ @cards.push Card.new(num, suit)
59
+ end
60
+ end
61
+ end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card_deck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2.pre.alpha.pre.86
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-10-07 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
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
26
  version: '3.0'
27
27
  description:
@@ -45,19 +45,18 @@ require_paths:
45
45
  - lib
46
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ">="
48
+ - - ! '>='
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - ! '>'
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 1.3.1
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 2.3.0
58
+ rubygems_version: 2.4.1
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: The central part of a card game
62
62
  test_files: []
63
- has_rdoc: