Class: Linkage::MatchRecorder

Inherits:
Object
  • Object
show all
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

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

#startObject



12
13
14
15
# File 'lib/linkage/match_recorder.rb', line 12

def start
  @matcher.add_observer(self)
  @match_set.open_for_writing
end

#stopObject



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