def generate_associations(titles)
@associations = {}
titles = titles.reject do |title|
if (entry = @entries[title]) && !entry.associated?
entry.associated = true
@associations[title] = entry.id
true
else
false
end
end
titles.reject! do |title|
if entry = find_moved(title)
@entries.delete(entry.title)
@entries[title] = entry
entry.title = title
entry.associated = true
entry.fuzzy = false
@associations[title] = entry.id
true
else
false
end
end
titles.reject! do |title|
if entry = find_similar(title)
@entries.delete(entry.title)
@entries[title] = entry
entry.title = title
entry.associated = true
entry.fuzzy = true
@associations[title] = entry.id
true
else
false
end
end
titles.each do |title|
id = create_unique_id(title)
add(title, id, false, true)
@associations[title] = id
end
end