card_deck 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mzg2NTIwZjhkNTg2NTgwZDJkZjc4ZjY5ZjU2MDU4YjYyNjRmZmJkNg==
4
+ M2E3MjhmNGM3ZWI2ZTczZWUzODk1MTc5ZTEwN2JkMzMzY2QxZWM0YQ==
5
5
  data.tar.gz: !binary |-
6
- NWZlN2IxODc1ZjIyZWUyODNlYWE1NmRhZmM0M2Q5NmRiYjIyYzc2OQ==
6
+ NjdkYWFjMjg3NDE3NzQxZWRiYTllY2RiMDBjNDU2N2JiMWZmNWU5YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTEyNmFlNDAwZmU3MzEyZWIxN2QyMjZhNzhlOWI4OGVlZDJmMWVjNjI5Mjkw
10
- ZjZlZDhiODM4NDVhYTQ2MjViN2YxN2E2NGQ4N2UxNDM2OWRhNDRiZTc3YTAw
11
- ZjNjNDc3YTY4OTc1NDg5Y2EzMWMyMzM5NmU0M2M4ODZkOWQ1ZjU=
9
+ MjVjZTY0NzJmMjQ3Y2I5NmJkYWNiNjEwZTUwNTk4NzBlZmRhZThjN2ZjYTVl
10
+ NDcxMjAzYjMxNTRlMzU0ZGY1YzZlMjQwNzI2MTZhNzc0ZjA4YTZlMjZiOGQ2
11
+ ODMwMjc5NzhmZjMxMDBjZWU3MzQ3YTNmOTVlYWNjNTZlMzAzZWU=
12
12
  data.tar.gz: !binary |-
13
- NzlkOWZmNzIzYzAxNjg1MmFhYzA3M2ZhYmE4NzExY2E5OTEwM2QwMjY5OTEz
14
- M2Q5NzgxNmNlNzFjMjIyMmRkZjUwMTRlYjgyZmMxNTlmNTFmNzhjYTIxOTEx
15
- YWZmMWJkMDczOTk3MDNlZWY3NTdmZjg2ZWRhMmEwMTRiOTJiYTg=
13
+ NTg1OGY0ZjVmZDc1YTIyM2MwNTM3MzU3MTRiZTE4Y2RlNjI0ZTQ5MWI1Y2Rm
14
+ MjExOTlkN2RlZGNmNzY5Yzk4N2MwNjU5MTk4NTc3YjFjYjJmOWM0YWZmMDQ2
15
+ NDhjOTA0N2JkMjE3MDVmNDhiMDQxNDkyODg3YWQ4YmZkMTEwYzE=
data/README.md CHANGED
@@ -7,3 +7,4 @@ Can include jokers
7
7
  [![Inline docs](http://inch-ci.org/github/zrp200/card_deck.png?branch=master)](http://inch-ci.org/github/zrp200/card_deck)
8
8
  [![Code Climate](https://codeclimate.com/github/Zrp200/card_deck/badges/gpa.svg)](https://codeclimate.com/github/Zrp200/card_deck)
9
9
  [![Build Status](https://travis-ci.org/Zrp200/card_deck.svg?branch=master)](https://travis-ci.org/Zrp200/card_deck)
10
+ [![Test Coverage](https://codeclimate.com/github/Zrp200/card_deck/badges/coverage.svg)](https://codeclimate.com/github/Zrp200/card_deck)
@@ -45,31 +45,11 @@
45
45
  @num
46
46
  end
47
47
  end
48
+ def black? # Tests if the suit color is black
49
+ suit == SPADES || suit == CLUBS
50
+ end
48
51
  alias abbr abbreviation # A shorter method name
49
52
  alias to_s abbr
50
53
  alias inspect abbr
51
54
  end
52
- # Card decks
53
- class Deck
54
- # The cards in the deck
55
- attr_accessor :cards
56
- alias inspect cards
57
- # Creates a new Deck. Includes Jokers when parmeter args == {jokers: true}
58
- def initialize(args=Hash.new(false))
59
- @cards = Array.new
60
- for suit in Card::SUIT
61
- suit = nil if args[:no_suits]
62
- stock 'Ace', suit
63
- for num in (2..10).to_a; stock num, suit; end
64
- stock 'Jack', suit
65
- stock 'Queen', suit
66
- stock 'King', suit
67
- end
68
- 2.times {stock 'Joker'} if args[:jokers]
69
- end
70
- private
71
- def stock(num, suit=nil) # Creates a Card to add to Deck#cards
72
- @cards.push Card.new num, suit
73
- end
74
- end
75
55
  end
data/lib/deck.rb ADDED
@@ -0,0 +1,21 @@
1
+ require_relative "card.rb"
2
+ module CardDeck
3
+ class Deck # The deck
4
+ # The cards in the deck
5
+ attr_accessor :cards
6
+ alias inspect cards
7
+ def initialize(args=Hash.new(false)) # Creates a new Deck. Includes Jokers when parmeter args == {jokers: true}
8
+ @cards = Array.new
9
+ for suit in Card::SUIT
10
+ stock 'Ace', suit
11
+ for num in (2..10).to_a; stock num, suit; end
12
+ stock 'Jack', suit
13
+ stock 'Queen', suit
14
+ stock 'King', suit
15
+ end
16
+ 2.times {stock 'Joker'} if args[:jokers]
17
+ end
18
+ private
19
+ def stock(num, suit=nil); @cards.push Card.new num, suit; end # Creates a Card to add to Deck#cards
20
+ end
21
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card_deck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.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-04 00:00:00.000000000 Z
11
+ date: 2014-11-17 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
- version: '3.1'
19
+ version: '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
- version: '3.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-its
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,8 @@ extra_rdoc_files:
49
49
  files:
50
50
  - LICENSE
51
51
  - README.md
52
- - lib/card_deck.rb
52
+ - lib/card.rb
53
+ - lib/deck.rb
53
54
  homepage: https://github.com/zrp200/card_deck
54
55
  licenses:
55
56
  - MIT