Module: Scorerb::Array

Included in:
Array
Defined in:
lib/scorerb/array.rb

Constant Summary collapse

OPTIONS =
{:fuzz => 0, :to_S => false}

Instance Method Summary collapse

Instance Method Details

#score(string, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/scorerb/array.rb', line 5

def score(string, options = {})
  return nil if empty?
  optional = OPTIONS.merge(options)
  matches = {}
  each do |against|
    against = against.to_s if optional[:to_s]
    current_score = { against => string.score(against, optional[:fuzz]) } 
    matches.update(current_score)
  end
  matches
end