Class: Cache::Client::KeyBuilder
- Inherits:
-
Object
- Object
- Cache::Client::KeyBuilder
- Defined in:
- lib/cache-client/key_builder.rb
Instance Method Summary collapse
-
#initialize(key) ⇒ KeyBuilder
constructor
A new instance of KeyBuilder.
- #to_s ⇒ Object
Constructor Details
#initialize(key) ⇒ KeyBuilder
Returns a new instance of KeyBuilder.
5 6 7 |
# File 'lib/cache-client/key_builder.rb', line 5 def initialize(key) @key = key end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/cache-client/key_builder.rb', line 9 def to_s return @key.to_cache_key if @key.respond_to?(:to_cache_key) return @key if @key.kind_of?(String) return @key.to_s if @key.kind_of?(Numeric) return Digest::SHA1.hexdigest(Marshal.dump(@key)) end |