Class: Eikon::Comparator
- Inherits:
-
Object
- Object
- Eikon::Comparator
- Extended by:
- T::Sig
- Defined in:
- lib/eikon/comparator.rb
Class Method Summary collapse
Class Method Details
.compare(dhash_1, dhash_2) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/eikon/comparator.rb', line 9 def self.compare(dhash_1, dhash_2) hamming_distance = 0 dhash_1.chars.each_with_index do |character, index| hamming_distance += 1 if character != dhash_2[index] end hamming_distance + (dhash_1.length - dhash_2.length).abs end |