cards_lib 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95003f09c263a8235c172a6916d125b1ed1dfad5
4
- data.tar.gz: ac9fe48a00e794703184c3022685e1f799b4917d
3
+ metadata.gz: e1bb4141856d6efdd82f36541751260759e812cf
4
+ data.tar.gz: df5377901eecdc5d3a1342327f91d2c6e5f9f80d
5
5
  SHA512:
6
- metadata.gz: 25d28d3d04807b82ca9e1f8108e94515bfd4033d7d3c6aa948984aa24a2eb15ff6892f411f6dcf232964e0b8362eb5aed56988787a94b02096a43852df6c9ae7
7
- data.tar.gz: 275b2e39c1a2bc67af05a5171147dcdffb035abff7bb2c094f6d31d62acdff2f76518eddbb2dda5bd0872708e1835749002429498894f201e9253cbd38b1f627
6
+ metadata.gz: a71706bd2c83929d2d7af31acf4e90a81495d84079f280a5b9f86a3220c90fd6902d0e879a9a2999ca88d9b9d2d1f26c4eb02105cfeaf250ce3235c81cc6caae
7
+ data.tar.gz: 70cb115f9e01ca9437e992ee45f9ca2ea99f112087e8cb3adff7d1fd4dff08bc19a65d29cba10aa6ad4ff2de379c5c140b5ae62dd1f4e13b578a2049253cf018
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.7
4
- - 2.2.3
3
+ - 2.2.5
4
+ - 2.3.2
5
5
  script: bundle exec rake test
6
6
  env:
7
7
  global:
@@ -2,9 +2,10 @@ module CardsLib
2
2
  class Deck
3
3
  def initialize(options = {})
4
4
  cards = options.fetch(:cards) { Standard::PLAYING_CARDS }
5
+ ranker = options.fetch(:ranker){ Ranker }
5
6
  @seed = options.fetch(:seed) { Random.new.seed }
6
7
  @top = 0
7
- @cards = cards.map {|c| Card.new(c) }.shuffle(random: Random.new(@seed)).to_enum
8
+ @cards = cards.map {|c| Card.new(c, ranker) }.shuffle(random: Random.new(@seed)).to_enum
8
9
  end
9
10
 
10
11
  def inspect
@@ -2,6 +2,10 @@ module CardsLib
2
2
  class Ranker
3
3
  include Comparable
4
4
  attr :rank, :rank_lookup
5
+ # Initialize's arguments:
6
+ # rank - is whatever part of the object, or the object itself you choose to use.
7
+ # ranks - is a simple hash to lookup a cards value with the keys matching the rank object.
8
+ # rank_lookup - is an optional Proc to redefine how you will lookup a cards value.
5
9
  def initialize(rank = nil, ranks = nil, rank_lookup = nil)
6
10
  @rank, @ranks, @rank_lookup = rank, ranks, rank_lookup
7
11
  end
@@ -1,3 +1,3 @@
1
1
  module CardsLib
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cards_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.5.0
135
+ rubygems_version: 2.6.4
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: OO Card Game Library