Class: Slosilo::Adapters::MockAdapter

Inherits:
Hash
  • Object
show all
Defined in:
lib/slosilo/adapters/mock_adapter.rb

Instance Method Summary collapse

Constructor Details

#initializeMockAdapter

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