Class: LooseTightDictionary::Score

Inherits:
Object
  • Object
show all
Defined in:
lib/loose_tight_dictionary/score.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str1, str2) ⇒ Score

Returns a new instance of Score.



11
12
13
14
# File 'lib/loose_tight_dictionary/score.rb', line 11

def initialize(str1, str2)
  @str1 = str1
  @str2 = str2
end

Instance Attribute Details

#str1Object (readonly)

Returns the value of attribute str1.



9
10
11
# File 'lib/loose_tight_dictionary/score.rb', line 9

def str1
  @str1
end

#str2Object (readonly)

Returns the value of attribute str2.



9
10
11
# File 'lib/loose_tight_dictionary/score.rb', line 9

def str2
  @str2
end

Instance Method Details

#<=>(other) ⇒ Object



24
25
26
# File 'lib/loose_tight_dictionary/score.rb', line 24

def <=>(other)
  to_f <=> other.to_f
end

#==(other) ⇒ Object



28
29
30
# File 'lib/loose_tight_dictionary/score.rb', line 28

def ==(other)
  to_f == other.to_f
end

#inspectObject



20
21
22
# File 'lib/loose_tight_dictionary/score.rb', line 20

def inspect
  %{#<Score: to_f=#{to_f}>}
end

#to_fObject



16
17
18
# File 'lib/loose_tight_dictionary/score.rb', line 16

def to_f
  @to_f ||= dices_coefficient(str1, str2)
end