Module: Soulmate

Extended by:
Soulmate
Included in:
Soulmate
Defined in:
lib/soulmate.rb,
lib/soulmate/base.rb,
lib/soulmate/loader.rb,
lib/soulmate/server.rb,
lib/soulmate/helpers.rb,
lib/soulmate/matcher.rb,
lib/soulmate/version.rb

Defined Under Namespace

Modules: Helpers, Version Classes: Base, Loader, Matcher, Server

Constant Summary collapse

MIN_COMPLETE =
2
DEFAULT_STOP_WORDS =
["vs", "at", "the"]

Instance Method Summary collapse

Instance Method Details

#redisObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/soulmate.rb', line 24

def redis
  @redis ||= (
    url = URI(@redis_url || ENV["REDIS_URL"] || "redis://127.0.0.1:6379/0")

    ::Redis.new({
      :host => url.host,
      :port => url.port,
      :db => url.path[1..-1],
      :password => url.password
    })
  )
end

#redis=(url) ⇒ Object



18
19
20
21
22
# File 'lib/soulmate.rb', line 18

def redis=(url)
  @redis = nil
  @redis_url = url
  redis
end

#stop_wordsObject



37
38
39
# File 'lib/soulmate.rb', line 37

def stop_words
  @stop_words ||= DEFAULT_STOP_WORDS
end

#stop_words=(arr) ⇒ Object



41
42
43
# File 'lib/soulmate.rb', line 41

def stop_words=(arr)
  @stop_words = Array(arr).flatten
end