card_deck 0.2.2.pre.alpha.pre.88 → 0.2.2

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 +5 -13
  2. data/LICENSE +21 -21
  3. data/README.md +9 -9
  4. data/lib/card_deck.rb +60 -61
  5. metadata +11 -11
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NmJjMjJhZGY0ZTJiZjQ0NmU4Yjc0ZWU2MWFmOTc2NWNlNGJmN2IzMg==
5
- data.tar.gz: !binary |-
6
- NzI2MTE2NjBlMjIxMDMxMDY4OTAyYWYyMGIxYWIwOGE2MGQzNWE2Zg==
2
+ SHA1:
3
+ metadata.gz: e52098dc9d7c739224ccfc497992a7fffcab8b35
4
+ data.tar.gz: 9f31687194f831d96a5af065520b00063b3c0c62
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- Y2ZkMzdlYWMxYzUxNDJhODViNjlkM2EyODQyN2Y0ZWY4N2Y5ZDAxZTMxYmM4
10
- MmU3ZDQ3ZTBhZGRjZTZkYzk2NTQ3ZGI4ZDNlNTU4ZWI2NGFjNmQ1Y2U4ZDE3
11
- MGFlZmI2NTc5YzY5MWZjZmJjMWFlYzNjNmEyNzhhMDUxMjI0YmQ=
12
- data.tar.gz: !binary |-
13
- ZjkxY2I0YzJlOWI5MTQ2YjVmMzVmYTk1YmY1M2M5MDNhZmYxNDIwNWY1ZmUy
14
- ZjlmZGUzZjU5M2JhMjQ2ZWVmOTIwN2FmYWQyYjIwNWU2YWM1NzMxNjBiYzcx
15
- NzYxNDQ0OTA0MTBlYzMwN2NiN2Q0NzJkNzE4MmNjOTZhOWRmYTQ=
6
+ metadata.gz: 0f1a894f3ac0d7a37bb9187137a588cf66f9bcbcf03bb1f0f60379e69bc5add487c22ccb2c5b810510444b194a1e31812749a6c769d77a03c86e326620b58900
7
+ data.tar.gz: 488fee2f0c391b9990dfdf46db27332f01414dd14838ca165f00d7451b58412d127624f2fdafcff04031017038b5992e569504d471a177ba5c7a3f99330f9d07
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,61 +1,60 @@
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
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
+ end
38
+ # Card decks
39
+ class Deck
40
+ # The cards in the deck
41
+ attr_accessor :cards
42
+ # Creates a new Deck. Includes Jokers when parameter jokers = true
43
+ def initialize(jokers=false)
44
+ @cards = Array.new
45
+ for suit in Card::SUIT
46
+ stock 'Ace', suit
47
+ for num in (2..10).to_a; stock num, suit; end
48
+ stock 'Jack', suit
49
+ stock 'Queen', suit
50
+ stock 'King', suit
51
+ end
52
+ 2.times {stock 'Joker'} if jokers
53
+ end
54
+ private
55
+ # Creates a Card to add to Deck#cards
56
+ def stock(num, suit=nil)
57
+ @cards.push Card.new(num, suit)
58
+ end
59
+ end
60
+ end
metadata CHANGED
@@ -1,32 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card_deck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.pre.alpha.pre.88
4
+ version: 0.2.2
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-09 00:00:00.000000000 Z
11
+ date: 2014-10-07 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
- description: Supplies the core parts of any card game. To use the deck, call shuffle
28
- on it.
29
- email: zrp200@gmail.com
27
+ description:
28
+ email:
30
29
  executables: []
31
30
  extensions: []
32
31
  extra_rdoc_files:
@@ -46,18 +45,19 @@ require_paths:
46
45
  - lib
47
46
  required_ruby_version: !ruby/object:Gem::Requirement
48
47
  requirements:
49
- - - ! '>='
48
+ - - ">="
50
49
  - !ruby/object:Gem::Version
51
50
  version: '0'
52
51
  required_rubygems_version: !ruby/object:Gem::Requirement
53
52
  requirements:
54
- - - ! '>'
53
+ - - ">="
55
54
  - !ruby/object:Gem::Version
56
- version: 1.3.1
55
+ version: '0'
57
56
  requirements: []
58
57
  rubyforge_project:
59
- rubygems_version: 2.4.1
58
+ rubygems_version: 2.3.0
60
59
  signing_key:
61
60
  specification_version: 4
62
61
  summary: The central part of a card game
63
62
  test_files: []
63
+ has_rdoc: