Sha256: a505b49c6b969f71716198a98549fee6f415cf252101879ba8cf5071d476c4ea

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

require "easy_redis/methods/getters"
require "easy_redis/methods/setters"
require "easy_redis/methods/deleters"

module EasyRedis
  
  module Methods

    def self.included(klass)
      klass.class_eval do
        include EasyRedis::Getters
        include EasyRedis::Setters
        include EasyRedis::Deleters
      end
    end

    def redis_key
      raise NonExistentObjectError if self.new_record? && EasyRedis::Redis.raise_non_existent_object_error?
      @redis_key ||= "#{EasyRedis::Redis.namespace}:attributes:#{self.class.name}:#{self.id}"
    end

    def redis_cli
      EasyRedis::Redis.redis
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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