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 +4 -4
- data/README.md +4 -0
- data/lib/swissper.rb +3 -1
- data/lib/swissper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea594dda0112adeaac6b41bf686e9df0e6607e8
|
4
|
+
data.tar.gz: bfab8b39c302399e639fe170bb86e066ccec24e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/swissper.rb
CHANGED
@@ -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
|
data/lib/swissper/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graph_matching
|