module Soulmate::Config
Constants
- DEFAULT_MIN_COMPLETE
- DEFAULT_STOP_WORDS
Attributes
min_complete[W]
Public Instance Methods
min_complete()
click to toggle source
# File lib/soulmate/config.rb, line 11 def min_complete @min_complete ||= DEFAULT_MIN_COMPLETE end
redis()
click to toggle source
Returns the current Redis connection. If none has been created, will create a new one.
# File lib/soulmate/config.rb, line 31 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=(server)
click to toggle source
Accepts:
1. A Redis URL String 'redis://host:port/db' 2. An existing instance of Redis, Redis::Namespace, etc.
# File lib/soulmate/config.rb, line 18 def redis=(server) if server.is_a?(String) @redis = nil @redis_url = server else @redis = server end redis end
stop_words()
click to toggle source
# File lib/soulmate/config.rb, line 44 def stop_words @stop_words ||= DEFAULT_STOP_WORDS end
stop_words=(arr)
click to toggle source
# File lib/soulmate/config.rb, line 48 def stop_words=(arr) @stop_words = Array(arr).flatten end