Sha256: 0c6f36984742c0006b1059d59d86a4c7291832d601b9f85f62a13d795140d50f

Contents?: true

Size: 872 Bytes

Versions: 3

Compression:

Stored size: 872 Bytes

Contents

require "easy_redis/version/version"
require "easy_redis/errors/non_existent_object_error"
require "easy_redis/initialize/active_record"

module EasyRedis

  class Redis

    @@redis = nil
    @@config = {
      namespace: "easyredis",
      raise_non_existent_object_error: true,
      redis: nil
    }
    @@valid_config_keys = @@config.keys

    class << self

      def redis
        @@redis
      end

      def redis=(redis)
        @@redis = redis
      end

      def namespace
        @@config[:namespace]
      end

      def raise_non_existent_object_error?
        @@config[:raise_non_existent_object_error]
      end

      def configure(opts = {})
        opts.each do |k,v|
          @@config[k.to_sym] = v if @@valid_config_keys.include? k.to_sym
        end
        self.redis = @@config[:redis] if @@config[:redis].present?
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easy_redis-1.0.0 lib/easy_redis/easy_redis.rb
easy_redis-0.1.0 lib/easy_redis/easy_redis.rb
easy_redis-0.0.3 lib/easy_redis/easy_redis.rb