Class: Simhilarity::Candidate

Inherits:
Object
  • Object
show all
Defined in:
lib/simhilarity/candidate.rb

Overview

A potential match between two Elements. It can calculate it’s own score.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a, b) ⇒ Candidate

:nodoc:



13
14
15
16
# File 'lib/simhilarity/candidate.rb', line 13

def initialize(a, b) #:nodoc:
  @a = a
  @b = b
end

Instance Attribute Details

#aObject (readonly)

first half of the candidate pair - the needle.



5
6
7
# File 'lib/simhilarity/candidate.rb', line 5

def a
  @a
end

#bObject (readonly)

first half of the candidate pair - the haystack.



8
9
10
# File 'lib/simhilarity/candidate.rb', line 8

def b
  @b
end

#scoreObject

the score between these two candidates



11
12
13
# File 'lib/simhilarity/candidate.rb', line 11

def score
  @score
end

Instance Method Details

#to_sObject

:nodoc:



18
19
20
# File 'lib/simhilarity/candidate.rb', line 18

def to_s #:nodoc:
  "Candidate #{score}: #{a.inspect}..#{b.inspect}"
end