class Coletivo::Similarity::BaseStrategy

Attributes

preferences[RW]

Public Instance Methods

similarity_between(one, other) click to toggle source
# File lib/coletivo/similarity/base_strategy.rb, line 6
def similarity_between(one, other)
  raise "The #similarity_between was not implemented in #{self.class}"
end
train_with(people_preferences) click to toggle source
# File lib/coletivo/similarity/base_strategy.rb, line 10
def train_with(people_preferences)
  @preferences = people_preferences
end

Protected Instance Methods

shared_items_between(one, other) click to toggle source
# File lib/coletivo/similarity/base_strategy.rb, line 16
def shared_items_between(one, other)
  return [] unless preferences[one] && preferences[other]

  preferences[one].keys.select { |item|
    preferences[other].keys.include? item
  }
end