Class: FuzzyMatch::Score
- Inherits:
-
Object
- Object
- FuzzyMatch::Score
- Defined in:
- lib/fuzzy_match/score.rb,
lib/fuzzy_match/score/amatch.rb,
lib/fuzzy_match/score/pure_ruby.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#str1 ⇒ Object
readonly
Returns the value of attribute str1.
-
#str2 ⇒ Object
readonly
Returns the value of attribute str2.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(str1, str2) ⇒ Score
constructor
A new instance of Score.
Constructor Details
#initialize(str1, str2) ⇒ Score
Returns a new instance of Score.
9 10 11 12 |
# File 'lib/fuzzy_match/score.rb', line 9 def initialize(str1, str2) @str1 = str1.downcase @str2 = str2.downcase end |
Instance Attribute Details
#str1 ⇒ Object (readonly)
Returns the value of attribute str1.
6 7 8 |
# File 'lib/fuzzy_match/score.rb', line 6 def str1 @str1 end |
#str2 ⇒ Object (readonly)
Returns the value of attribute str2.
7 8 9 |
# File 'lib/fuzzy_match/score.rb', line 7 def str2 @str2 end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/fuzzy_match/score.rb', line 14 def <=>(other) by_dices_coefficient = (dices_coefficient_similar <=> other.dices_coefficient_similar) if by_dices_coefficient == 0 levenshtein_similar <=> other.levenshtein_similar else by_dices_coefficient end end |