Sha256: 36ba95b440d2280f3691c15bf0b1abb454f4b213c163126d64bb300f53cb84bc

Contents?: true

Size: 552 Bytes

Versions: 2

Compression:

Stored size: 552 Bytes

Contents

module Seabright
	module Keys
		
		def key(ident = id)
			"#{self.class.cname}:#{ident.gsub(/^.*:/,'')}"
		end
		
		def reserve_key(ident = id)
			"#{key(ident)}_reserve"
		end
		
		def hkey(ident = nil)
			"#{key}_h"
		end
		
		module ClassMethods
			
			def key(ident=nil)
				"#{cname}#{ident ? ":#{ident.gsub(/^.*:/,'')}" : ""}"
			end
			
			def reserve_key(ident=nil)
				"#{key(ident)}_reserve"
			end
			
			def hkey(ident = nil)
				"#{key(ident)}_h"
			end
			
		end
		
		def self.included(base)
			base.extend(ClassMethods)
		end
		
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis_object-1.1 lib/redis_object/keys.rb
redis_object-0.5.0 lib/redis_object/keys.rb