Class: StableMarriage
- Inherits:
-
Object
- Object
- StableMarriage
- Defined in:
- lib/stable_marriage.rb,
lib/stable_marriage/version.rb,
lib/stable_marriage/match_set.rb,
lib/stable_marriage/preference.rb,
lib/stable_marriage/match_maker.rb,
lib/stable_marriage/descending_insertion_sort_array.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
-
#add_match(suitor, suitee, score) ⇒ Object
The the matching between the suitor and suitee with the match score.
-
#initialize ⇒ StableMarriage
constructor
A new instance of StableMarriage.
-
#proposals ⇒ Hash<Object, Object>
A map with suitors as keys and suitees as objects.
Constructor Details
#initialize ⇒ StableMarriage
Returns a new instance of StableMarriage.
5 6 7 |
# File 'lib/stable_marriage.rb', line 5 def initialize @match_set = MatchSet.new end |
Instance Method Details
#add_match(suitor, suitee, score) ⇒ Object
The the matching between the suitor and suitee with the match score.
17 18 19 |
# File 'lib/stable_marriage.rb', line 17 def add_match(suitor, suitee, score) match_set.add(suitor, suitee, score) end |
#proposals ⇒ Hash<Object, Object>
A map with suitors as keys and suitees as objects
25 26 27 |
# File 'lib/stable_marriage.rb', line 25 def proposals MatchMaker.new(match_set).proposals end |