Sha256: 078f80f695da96dba4e93f66304b1e81fac5ff95b3a711eb2a6d24c15953586c
Contents?: true
Size: 704 Bytes
Versions: 1
Compression:
Stored size: 704 Bytes
Contents
module Hari module Configuration module Redis def redis @redis || begin self.redis = 'localhost:6379' @redis end end def redis=(server) @redis = redis_namespace(server) end private def redis_namespace(server) prefix = 'hari' if server.kind_of?(::Redis::Namespace) prefix = "#{server.namespace}:#{prefix}" end ::Redis::Namespace.new prefix, redis_server(server) end def redis_server(server) return server unless server.kind_of?(::String) host, port = server.split(':') ::Redis.new host: host, port: port end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hari-0.0.5 | lib/hari/configuration/redis.rb |