card_deck 4.02 → 5.0.0.pre.345
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card_deck/deck.rb +9 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 146bb58b79c3ea95cab6bb77a057034a198d83fd04ef16a246a74f6db1aeb9ec
|
4
|
+
data.tar.gz: af5db2a883a7cf16ec6988586e78dd0a4727eaabc5abec9776cb1a6978d5c058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 375ffe7aa9e1411681dd891ba4a727b717c6c380bdb196086d90115e72ed30c34507ec4a866bff0e0dfdcbf4cbfff49ce4d1fab9b3d31d9edf41507cf53c6996
|
7
|
+
data.tar.gz: 15d6c9f57dd0079fa6437c7b0ba27b89ad605a5a44d4893346d9a71cc69e5fca92225dd85b8bddf32ee1413564c05721dcea168c1a04cb460d5838d36186d5ad
|
data/lib/card_deck/deck.rb
CHANGED
@@ -3,22 +3,17 @@ module CardDeck
|
|
3
3
|
def Deck(args=Hash.new(false))
|
4
4
|
Deck.new args
|
5
5
|
end
|
6
|
-
class Deck # The deck
|
7
|
-
|
8
|
-
|
9
|
-
@cards = Array.new
|
6
|
+
class Deck < SimpleDelegator # The deck
|
7
|
+
def initialize(args=Hash.new(false)) # Creates a new Deck. Includes Jokers when parameter args == {jokers: true}
|
8
|
+
super(Array.new)
|
10
9
|
Card::Suit.each do |suit|
|
11
|
-
|
12
|
-
(2..10).each {|num|
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
push Card.new('Ace', suit)
|
11
|
+
(2..10).each {|num| push Card.new(num, suit)}
|
12
|
+
push Card.new('Jack', suit)
|
13
|
+
push Card.new('Queen', suit)
|
14
|
+
push Card.new('King', suit)
|
16
15
|
end
|
17
|
-
2.times {
|
16
|
+
2.times {push Card.new('Joker')} if args[:jokers]
|
18
17
|
end
|
19
|
-
private
|
20
|
-
def stock(num, suit=Card::Suit.sample) # Creates a Card to add to Deck#cards
|
21
|
-
@cards.push Card.new num, suit
|
22
|
-
end
|
23
18
|
end
|
24
19
|
end
|
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:
|
4
|
+
version: 5.0.0.pre.345
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Perlmutter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -67,9 +67,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
67
|
version: '0'
|
68
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- - "
|
70
|
+
- - ">"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
72
|
+
version: 1.3.1
|
73
73
|
requirements: []
|
74
74
|
rubyforge_project:
|
75
75
|
rubygems_version: 2.7.4
|