Class: GuessWhoNoFuzzy::Scorer
- Inherits:
-
Object
- Object
- GuessWhoNoFuzzy::Scorer
- Defined in:
- lib/guess_who_no_fuzzy/scorer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token_array) ⇒ Scorer
constructor
A new instance of Scorer.
- #score! ⇒ Object
Constructor Details
#initialize(token_array) ⇒ Scorer
Returns a new instance of Scorer.
15 16 17 |
# File 'lib/guess_who_no_fuzzy/scorer.rb', line 15 def initialize(token_array) @token_array = token_array end |
Class Method Details
Instance Method Details
#score! ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/guess_who_no_fuzzy/scorer.rb', line 19 def score! score = 0 @token_array.each do |token| score += 1.0 if included_in_names?(token) end score /= @token_array.length score end |