Sha256: 7be5f92ec52a3e053219426f8faf9cf5d0960adc0f50a1d0af898244084d6f24

Contents?: true

Size: 735 Bytes

Versions: 11

Compression:

Stored size: 735 Bytes

Contents

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
redis_object-1.5.0 lib/redis_object/keys.rb
redis_object-1.4.9 lib/redis_object/keys.rb
redis_object-1.4.8 lib/redis_object/keys.rb
redis_object-1.4.7 lib/redis_object/keys.rb
redis_object-1.4.6 lib/redis_object/keys.rb
redis_object-1.4.5 lib/redis_object/keys.rb
redis_object-1.4.3 lib/redis_object/keys.rb
redis_object-1.4.2 lib/redis_object/keys.rb
redis_object-1.4.1 lib/redis_object/keys.rb
redis_object-1.4.0 lib/redis_object/keys.rb
redis_object-1.3.9 lib/redis_object/keys.rb