Module: RedisClientOptions
- Defined in:
- lib/redis_client_options.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/redis_client_options.rb', line 5 def self.included(base) base.extend(ClassMethods) base.class_eval do end end |
Instance Method Details
#default_redis_options ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/redis_client_options.rb', line 12 def opts = {} opts[:password] = config[:password] if config[:password] opts[:timeout] = config[:timeout] if config[:timeout] opts[:db] = config[:database] if config[:database] if config[:socket] opts[:path] = config[:socket] else opts[:host] = config[:host] opts[:port] = config[:port] end opts end |
#redis_endpoint ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/redis_client_options.rb', line 27 def redis_endpoint if config[:socket] "unix://#{config[:socket]}" else "#{config[:host]}:#{config[:port]}" end end |