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
- #cache_expire ⇒ Object
- #index_fields ⇒ Object
- #minimal_word ⇒ Object
- #namespace ⇒ Object
- #search_limit ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#cache_expire ⇒ Object
15 16 17 |
# File 'lib/spinel/config.rb', line 15 def cache_expire @cache_expire ||= DEFAULT_CACHE_EXPIRE end |
#index_fields ⇒ Object
23 24 25 |
# File 'lib/spinel/config.rb', line 23 def index_fields Array(@index_fields ||= DEFAULT_INDEX_FIELDS) end |
#minimal_word ⇒ Object
11 12 13 |
# File 'lib/spinel/config.rb', line 11 def minimal_word @minimal_word ||= DEFAULT_MINIMAL_WORD end |
#namespace ⇒ Object
27 28 29 |
# File 'lib/spinel/config.rb', line 27 def namespace @namespace ||= DEFAULT_NAMESPACE end |
#search_limit ⇒ Object
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
40 41 42 43 |
# File 'lib/spinel/config.rb', line 40 def configure yield self self end |
#redis ⇒ Object
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 |