rasam 0.2.1 → 0.2.3
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.
- checksums.yaml +4 -4
- data/lib/rasam.rb +8 -53
- data/lib/rasam/version.rb +1 -1
- data/rasam.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb330f4a39afa919a29872b4249db6d69508633
|
4
|
+
data.tar.gz: 42ce22267bff052d5fbccd87503de4ea949a2035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e78d630959c5df719f4f591b5201bd6536fe260e97975218612fd747e7dccc3c0aac53bc36787d5dd693545efae1ae541d8132d8c50451c42516aec873e8336
|
7
|
+
data.tar.gz: a57da9411abc696ae28bcb13b7bc0defb5f82d46cf3d722ec3eff699da9cb4209ead5c613e39b6d4ce822c17b3ad2ed311c6ebecf16cd30d1f5517473197d7e8
|
data/lib/rasam.rb
CHANGED
@@ -62,65 +62,20 @@ module Rasam
|
|
62
62
|
result
|
63
63
|
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
def tie(a, b)
|
68
|
-
a == b
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
class Engine
|
73
|
-
def initialize(options, pair, choice, criteria)
|
74
|
-
@pr = PairRank.new(options)
|
75
|
-
rc = RationalChoice.new(pair, choice, criteria)
|
76
|
-
@pr.make(rc)
|
65
|
+
def break_tie(pair, choice, criteria)
|
66
|
+
make_rational_choice(pair, choice, criteria)
|
77
67
|
end
|
78
68
|
|
79
|
-
def
|
80
|
-
|
69
|
+
def make_rational_choice(pair, choice, criteria)
|
70
|
+
rc = RationalChoice.new(pair, choice, criteria)
|
71
|
+
make(rc)
|
81
72
|
end
|
82
73
|
|
83
|
-
|
84
|
-
@pr.score_for(choice)
|
85
|
-
end
|
74
|
+
private
|
86
75
|
|
87
|
-
def
|
88
|
-
|
76
|
+
def tie(a, b)
|
77
|
+
a == b
|
89
78
|
end
|
90
79
|
end
|
91
|
-
|
92
|
-
# Simulates a complete session
|
93
|
-
class Simulator
|
94
|
-
def initialize(options, choices, criteria)
|
95
|
-
@pr = PairRank.new(options)
|
96
|
-
@choices = choices
|
97
|
-
@criteria = criteria
|
98
|
-
end
|
99
|
-
|
100
|
-
def simulate
|
101
|
-
@pr.combinations.each_with_index do |pair, index|
|
102
|
-
choice = @choices[index]
|
103
|
-
|
104
|
-
rc = RationalChoice.new(pair, choice, @criteria)
|
105
|
-
@pr.make(rc)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def score_for(choice)
|
110
|
-
@pr.score_for(choice)
|
111
|
-
end
|
112
80
|
|
113
|
-
def tied_pair
|
114
|
-
@pr.tied_pair
|
115
|
-
end
|
116
|
-
|
117
|
-
def break_tie(pair, choice, criteria)
|
118
|
-
rc = RationalChoice.new(pair, choice, criteria)
|
119
|
-
@pr.make(rc)
|
120
|
-
end
|
121
|
-
|
122
|
-
def decisions
|
123
|
-
@pr.decisions
|
124
|
-
end
|
125
|
-
end
|
126
81
|
end
|
data/lib/rasam/version.rb
CHANGED
data/rasam.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bala Paranj
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.4'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.4'
|
55
55
|
description: Select a single winner using votes that express preferences. This can
|
56
56
|
also be used to create a sorted list of winners
|
57
57
|
email:
|