Sha256: 5d6ba39e24f070ff399089581e3b4807dd457a538d77e48905c55836aff60aa1
Contents?: true
Size: 604 Bytes
Versions: 18
Compression:
Stored size: 604 Bytes
Contents
require 'slosilo/adapters/abstract_adapter' module Slosilo module Adapters class MemoryAdapter < AbstractAdapter def initialize @keys = {} @fingerprints = {} end def put_key id, key key = Slosilo::Key.new(key) if key.is_a?(String) @keys[id] = key @fingerprints[key.fingerprint] = id end def get_key id @keys[id] end def get_by_fingerprint fp id = @fingerprints[fp] [@keys[id], id] end def each(&block) @keys.each(&block) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems