Class: Blobby::KeyTransformingStore
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Blobby::KeyTransformingStore
- Defined in:
- lib/blobby/key_transforming_store.rb
Overview
A BLOB store that decorates another store and allows key transformation
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(store, &key_transformation_strategy) ⇒ KeyTransformingStore
constructor
A new instance of KeyTransformingStore.
Constructor Details
#initialize(store, &key_transformation_strategy) ⇒ KeyTransformingStore
Returns a new instance of KeyTransformingStore.
15 16 17 18 |
# File 'lib/blobby/key_transforming_store.rb', line 15 def initialize(store, &key_transformation_strategy) super(store) @key_transformation_strategy = key_transformation_strategy end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 23 |
# File 'lib/blobby/key_transforming_store.rb', line 20 def [](key) transformed_key = @key_transformation_strategy.call(key) __getobj__[transformed_key] end |