Sha256: 9715ece6e9bd8afa4e8876a699aea383b978d1a587187d00578b942a8882cd4f

Contents?: true

Size: 424 Bytes

Versions: 6

Compression:

Stored size: 424 Bytes

Contents

require 'amatch'

class LooseTightDictionary
  class Score
    attr_reader :str1, :str2

    def initialize(str1, str2)
      @str1 = str1
      @str2 = str2
    end
    
    def to_f
      @to_f ||= str1.pair_distance_similar str2
    end
    
    def inspect
      %{#<Score: to_f=#{to_f}>}
    end
    
    def <=>(other)
      to_f <=> other.to_f
    end
    
    def ==(other)
      to_f == other.to_f
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
loose_tight_dictionary-0.2.3 lib/loose_tight_dictionary/score.rb
loose_tight_dictionary-0.2.2 lib/loose_tight_dictionary/score.rb
loose_tight_dictionary-0.2.1 lib/loose_tight_dictionary/score.rb
loose_tight_dictionary-0.2.0 lib/loose_tight_dictionary/score.rb
loose_tight_dictionary-0.1.1 lib/loose_tight_dictionary/score.rb
loose_tight_dictionary-0.1.0 lib/loose_tight_dictionary/score.rb