Sha256: c2f16e631265eab10968fe75cab27022169eabb02668f871a01c288f857b5012

Contents?: true

Size: 455 Bytes

Versions: 3

Compression:

Stored size: 455 Bytes

Contents

module Findable
  module Connection
    extend ActiveSupport::Concern

    module ClassMethods
      def redis
        @_redis ||= generate_redis_connection!
      end

      private
        def generate_redis_connection!
          redis_options ? Redis.new(*redis_options) : Redis.current
        end

        def redis_options
          Findable.config.redis_options.presence
        end
    end

    def redis
      self.class.redis
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
findable-0.0.3 lib/findable/connection.rb
findable-0.0.2 lib/findable/connection.rb
findable-0.0.1 lib/findable/connection.rb