Class: Slosilo::Adapters::MockAdapter
- Inherits:
-
Hash
- Object
- Hash
- Slosilo::Adapters::MockAdapter
- Defined in:
- lib/slosilo/adapters/mock_adapter.rb
Instance Method Summary collapse
- #get_by_fingerprint(fp) ⇒ Object
-
#initialize ⇒ MockAdapter
constructor
A new instance of MockAdapter.
- #put_key(id, key) ⇒ Object
Constructor Details
#initialize ⇒ MockAdapter
Returns a new instance of MockAdapter.
4 5 6 |
# File 'lib/slosilo/adapters/mock_adapter.rb', line 4 def initialize @fp = {} end |
Instance Method Details
#get_by_fingerprint(fp) ⇒ Object
15 16 17 18 |
# File 'lib/slosilo/adapters/mock_adapter.rb', line 15 def get_by_fingerprint fp id = @fp[fp] [self[id], id] end |
#put_key(id, key) ⇒ Object
8 9 10 11 |
# File 'lib/slosilo/adapters/mock_adapter.rb', line 8 def put_key id, key @fp[key.fingerprint] = id self[id] = key end |