swissper 0.2.1 → 0.3.0

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: 472c0070be8d6f75e08bdacb6b93886408bda5fd
4
- data.tar.gz: be5dd1b4d7c781faa1ba395b35a65b5d982e0e05
3
+ metadata.gz: 6ea594dda0112adeaac6b41bf686e9df0e6607e8
4
+ data.tar.gz: bfab8b39c302399e639fe170bb86e066ccec24e8
5
5
  SHA512:
6
- metadata.gz: de53e20408c56dbe56d59e2d1b8a450bd76c0815f02d141869b705ded29f5f58fa26a8d80b3cc2e341debeeaebac730b2c455aab7fda1323794acb4931ddf564
7
- data.tar.gz: 52424d4134fdeaa160d7797cbde272b7033ed2bb9461206d1c525573069534af0459b2ccb896b40b9e45669d3b95557a090bc3f0eebc2ab7792a78595ec0fef3
6
+ metadata.gz: 4d97ec88694ca94a7f348fa6f8c93bd776482d48a08e5b02f37d2f97f1e41c0fcfa9bbc5295108fee70bb3a89f594217bbcb603f54f871e37f5cf1391f79e44a
7
+ data.tar.gz: 62bfd85a3c7d2d3aebede986540c9cc346848b143a9edacf77c0b63e1304014cd161758b6c4eda71ff672ecf320a8417af328a433a7ecafbafcc10c11ad37a2e
data/README.md CHANGED
@@ -116,6 +116,10 @@ Swissper.pair([snap, crackle, pop])
116
116
 
117
117
  Please don't manually pass in `Swissper::Bye` in your array of players, passing in an odd-length array is the correct way to use byes.
118
118
 
119
+ ### Bye delta
120
+
121
+ Byes have a default delta of -1 by default, but you can override this with the `bye_delta` option.
122
+
119
123
  ## Development
120
124
 
121
125
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -12,6 +12,7 @@ module Swissper
12
12
  def initialize(options = {})
13
13
  @delta_key = options[:delta_key] || :delta
14
14
  @exclude_key = options[:exclude_key] || :exclude
15
+ @bye_delta = options[:bye_delta] || -1
15
16
  end
16
17
 
17
18
  def pair(player_data)
@@ -23,7 +24,7 @@ module Swissper
23
24
 
24
25
  private
25
26
 
26
- attr_reader :delta_key, :exclude_key
27
+ attr_reader :delta_key, :exclude_key, :bye_delta
27
28
 
28
29
  def graph
29
30
  edges = [].tap do |e|
@@ -50,6 +51,7 @@ module Swissper
50
51
 
51
52
  def delta_value(player)
52
53
  return player.send(delta_key) if player.respond_to?(delta_key)
54
+ return bye_delta if player == Swissper::Bye
53
55
 
54
56
  0
55
57
  end
@@ -1,3 +1,3 @@
1
1
  module Swissper
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swissper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John O'Brien
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-09 00:00:00.000000000 Z
11
+ date: 2017-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graph_matching