Sha256: 4141cbf2e6600c3bd286a108729e0fb991a66452d6ded33bd1fb724757259fc5

Contents?: true

Size: 584 Bytes

Versions: 3

Compression:

Stored size: 584 Bytes

Contents

require "redisable/version"
require "redis"

module Redisable
  autoload :Config, "redisable/config"
  autoload :Connection, "redisable/connection"
  autoload :Key, "redisable/key"

  def self.included(base)
    base.extend ClassMethods
    base.send :include, InstanceMethods
    base.send :include, Key
  end

  module ClassMethods
    attr_accessor :redis_server
    def redis
      server = redis_server || :application
      Redisable::Connection.conn(server)
    end
  end

  module InstanceMethods
    private
    def redis
      @_redis ||= self.class.redis
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redisable-0.2.0 lib/redisable.rb
redisable-0.1.1 lib/redisable.rb
redisable-0.1.0 lib/redisable.rb