Sha256: af3e74ebb3e8726cbdc81b9319d7f276709b231b32af693f55662ce616e42709

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

require "easy_redis/version/version"
require "easy_redis/initialize/active_record"

module EasyRedis

  class Redis

    @@redis = nil
    @@config = {
      namespace: "easyredis",
      type_cast: 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 use_type_casting?
        @@config[:type_cast]
      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

1 entries across 1 versions & 1 rubygems

Version Path
easy_redis-0.0.2 lib/easy_redis/easy_redis.rb