Module: Spinel::Config

Included in:
Spinel
Defined in:
lib/spinel/config.rb

Constant Summary collapse

DEFAULT_MINIMAL_WORD =
2
DEFAULT_CACHE_EXPIRE =
600
DEFAULT_SEARCH_LIMIT =
10
DEFAULT_INDEX_FIELDS =
[:body]
DEFAULT_NAMESPACE =
'spinel'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_expireObject



15
16
17
# File 'lib/spinel/config.rb', line 15

def cache_expire
  @cache_expire ||= DEFAULT_CACHE_EXPIRE
end

#index_fieldsObject



23
24
25
# File 'lib/spinel/config.rb', line 23

def index_fields
  Array(@index_fields ||= DEFAULT_INDEX_FIELDS)
end

#minimal_wordObject



11
12
13
# File 'lib/spinel/config.rb', line 11

def minimal_word
  @minimal_word ||= DEFAULT_MINIMAL_WORD
end

#namespaceObject



27
28
29
# File 'lib/spinel/config.rb', line 27

def namespace
  @namespace ||= DEFAULT_NAMESPACE
end

#search_limitObject



19
20
21
# File 'lib/spinel/config.rb', line 19

def search_limit
  @search_limit ||= DEFAULT_SEARCH_LIMIT
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



40
41
42
43
# File 'lib/spinel/config.rb', line 40

def configure
  yield self
  self
end

#redisObject



35
36
37
38
# File 'lib/spinel/config.rb', line 35

def redis
  @redis || $redis || Redis.current ||
    raise(NotConnected, "Redis::Objects.redis not set to a Redis.new connection")
end

#redis=(conn) ⇒ Object



31
32
33
# File 'lib/spinel/config.rb', line 31

def redis= conn
  @redis = Spinel::ConnectionPoolProxy.proxy_if_needed(conn)
end