Class: Linkage::MatchRecorder
- Inherits:
-
Object
- Object
- Linkage::MatchRecorder
- Defined in:
- lib/linkage/match_recorder.rb
Overview
MatchRecorder is responsible for observing Matcher for changes and saving matches to a MatchSet via Linkage::MatchSet#add_match.
Instance Method Summary collapse
-
#initialize(matcher, match_set) ⇒ MatchRecorder
constructor
A new instance of MatchRecorder.
- #start ⇒ Object
- #stop ⇒ Object
- #update(id_1, id_2, score) ⇒ Object
Constructor Details
#initialize(matcher, match_set) ⇒ MatchRecorder
7 8 9 10 |
# File 'lib/linkage/match_recorder.rb', line 7 def initialize(matcher, match_set) @matcher = matcher @match_set = match_set end |
Instance Method Details
#start ⇒ Object
12 13 14 15 |
# File 'lib/linkage/match_recorder.rb', line 12 def start @matcher.add_observer(self) @match_set.open_for_writing end |
#stop ⇒ Object
21 22 23 24 |
# File 'lib/linkage/match_recorder.rb', line 21 def stop @match_set.close @matcher.delete_observer(self) end |
#update(id_1, id_2, score) ⇒ Object
17 18 19 |
# File 'lib/linkage/match_recorder.rb', line 17 def update(id_1, id_2, score) @match_set.add_match(id_1, id_2, score) end |