card_deck 0.2.3.pre.alpha.pre.90 → 1.0.0.pre.134

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 +9 -5
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmQ5Mjg5ZTE0N2NiMzczNDdmY2RmOTZkMWY3ZWEyM2YxMzdkMTk3Ng==
4
+ ZTQyMjgxMzc3YjQyMmMzYjEwMzQxMGIwN2M5ODU4OTkzZDg2YjVhYg==
5
5
  data.tar.gz: !binary |-
6
- Yzg4MTY1NGUxYjIwOTgyMTY4ZGJiZTgxNTZkMTQxYjhhM2Q1NTMxNg==
6
+ NWY0NTA3YjAwYjllYWJmNWU0MGRmYjQyOTZjM2QyYzdkMzRlY2YxMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmU3ZjE3M2YwYTIyYTJhMmVlMTk4NTg2YjYyYmNmNzYxODRjZWYzYjI2MTcz
10
- ZDViYmY2NjBkY2ZiODA4NWM1MTg4ZjkzYzMzNGZiNjhlOTY5OTUwZmZlNmYx
11
- MGNiZTdhNzNjNzFlY2YzYjUyOTg5OGI4NDk1ODU2M2EwOWUzYWI=
9
+ MzJmOGE1NGRlMzU5NjUxZTJhMzk3ODAwZjM5NTEzOGU3OGJiY2VjMzE5ZDA4
10
+ NGNlM2ZiYjI2MTM5ZWM4ZDQ0YTMzNjUwMjY0NWMyNDRmMzFlYTI4NmFiYjgy
11
+ ZjJmMTg3MTUzMmRiM2UwNDM4NWUxOGU3Nzc1NjY4M2Y5NGIxMGQ=
12
12
  data.tar.gz: !binary |-
13
- NDNjN2U0NTZmMTliYzg3NmQ3YzJjZDBiY2ExOGU1YWFkNjVhMzBlZjJkNzdj
14
- MTMzZjg4ZTQ4OGNlYjEwNTA4MGEzOTJjZmUzMWZiMTVmNTllMGZjN2VlMDI0
15
- NmUzYTU5MWI0ZWQyNzgwMzhkMTVmODBmNjNmZDQ5ZmMwODJhODk=
13
+ YTQ1OWI3MWRhNTI0N2IzOTRiMjdlNmM3ZTY5MWIxNDQ3NTJkOGQ3ZjMyNmQ0
14
+ OWRjZGM0NWUxYzlkMTI0YTE2YmNiOWRhM2RiNjY1OTU2OWRmZmRiNDIyOTli
15
+ ZTVlNjM4NWUzMjcxMThiZjE1YTQ1M2Q4NjdlM2ZlOTZmNzM5Yzc=
data/lib/card_deck.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # The gem
2
2
  module CardDeck
3
3
  # Gem Version
4
- VERSION = "0.2.2"
4
+ VERSION = "2.0.3"
5
5
  # Errors for when you incorrectly use a card.
6
6
  class CardError < StandardError; end
7
7
  class Card # The central part of any card game. It is what makes card games 'Card' games.
@@ -23,6 +23,9 @@
23
23
  @num, @suit = num, suit
24
24
  end
25
25
  end
26
+ def self.gen # Creates a random new card.
27
+ self.new NUM.sample, SUIT.sample
28
+ end
26
29
  def abbreviation # The short version of the card
27
30
  unless @num == "Joker"
28
31
  if @num == 10 then "#{@suit}#{@num}"
@@ -35,11 +38,13 @@
35
38
  end
36
39
  alias abbr abbreviation # A shorter method name
37
40
  alias to_s abbr
41
+ alias inspect abbr
38
42
  end
39
43
  # Card decks
40
44
  class Deck
41
45
  # The cards in the deck
42
46
  attr_accessor :cards
47
+ alias inspect cards
43
48
  # Creates a new Deck. Includes Jokers when parameter jokers = true
44
49
  def initialize(jokers=false)
45
50
  @cards = Array.new
@@ -53,9 +58,8 @@
53
58
  2.times {stock 'Joker'} if jokers
54
59
  end
55
60
  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
61
+ def stock(num, suit=nil) # Creates a Card to add to Deck#cards
62
+ @cards.push Card.new num, suit
63
+ end
60
64
  end
61
65
  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: 0.2.3.pre.alpha.pre.90
4
+ version: 1.0.0.pre.134
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-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: 1.3.1
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.4.1
59
+ rubygems_version: 2.4.2
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: The central part of a card game