Class: FamilyReunion

Inherits:
Object
  • Object
show all
Defined in:
lib/family-reunion.rb,
lib/family-reunion/cache.rb,
lib/family-reunion/top_node.rb,
lib/family-reunion/exact_matcher.rb,
lib/family-reunion/fuzzy_matcher.rb,
lib/family-reunion/matcher_helper.rb,
lib/family-reunion/nomatch_organizer.rb,
lib/family-reunion/taxamatch_wrapper.rb,
lib/family-reunion/taxamatch_preprocessor.rb

Defined Under Namespace

Modules: MatcherHelper Classes: Cache, ExactMatcher, FuzzyMatcher, NomatchOrganizer, TaxamatchPreprocessor, TaxamatchWrapper, TopNode

Constant Summary collapse

VERSION =
open(File.join(File.dirname(__FILE__), '..', 'VERSION')).readline.strip

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(primary_node, secondary_node) ⇒ FamilyReunion

Returns a new instance of FamilyReunion.



37
38
39
40
41
42
43
44
45
# File 'lib/family-reunion.rb', line 37

def initialize(primary_node, secondary_node)
  @primary_node = FamilyReunion::TopNode.new(primary_node)
  @secondary_node = FamilyReunion::TopNode.new(secondary_node)
  @primary_valid_names_set = Set.new(@primary_node.valid_names_hash.keys)
  @secondary_valid_names_set = Set.new(@secondary_node.valid_names_hash.keys)
  @primary_synonyms_set = Set.new(@primary_node.synonyms_hash.keys)
  @secondary_synonyms_set = Set.new(@secondary_node.synonyms_hash.keys)
  @merges = nil
end

Instance Attribute Details

#mergesObject (readonly)

Returns the value of attribute merges.



15
16
17
# File 'lib/family-reunion.rb', line 15

def merges
  @merges
end

#primary_nodeObject (readonly)

Returns the value of attribute primary_node.



15
16
17
# File 'lib/family-reunion.rb', line 15

def primary_node
  @primary_node
end

#primary_synonyms_setObject (readonly)

Returns the value of attribute primary_synonyms_set.



17
18
19
# File 'lib/family-reunion.rb', line 17

def primary_synonyms_set
  @primary_synonyms_set
end

#primary_valid_names_setObject (readonly)

Returns the value of attribute primary_valid_names_set.



16
17
18
# File 'lib/family-reunion.rb', line 16

def primary_valid_names_set
  @primary_valid_names_set
end

#secondary_nodeObject (readonly)

Returns the value of attribute secondary_node.



15
16
17
# File 'lib/family-reunion.rb', line 15

def secondary_node
  @secondary_node
end

Class Method Details

.loggerObject



21
22
23
# File 'lib/family-reunion.rb', line 21

def self.logger
  @@logger ||= Logger.new(nil)
end

.logger=(logger) ⇒ Object



25
26
27
# File 'lib/family-reunion.rb', line 25

def self.logger=(logger)
  @@logger = logger
end

.logger_resetObject



29
30
31
# File 'lib/family-reunion.rb', line 29

def self.logger_reset
  self.logger = Logger.new(nil)
end

.logger_write(obj_id, message, method = :info) ⇒ Object



33
34
35
# File 'lib/family-reunion.rb', line 33

def self.logger_write(obj_id, message, method = :info)
  self.logger.send(method, "|%s|%s|" % [obj_id, message])
end

Instance Method Details

#mergeObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/family-reunion.rb', line 47

def merge
  unless @merges
    @merges = {}
    merge_exact_matches
    merge_fuzzy_matches
    merge_no_matches
    FamilyReunion.logger_write(self.object_id, "Merging is complete")
  end
  @merges
end