Class: Hold::InMemory::HashRepository
- Inherits:
-
Object
- Object
- Hold::InMemory::HashRepository
show all
- Includes:
- HashRepository
- Defined in:
- lib/hold/in_memory/hash_repository.rb
Instance Method Summary
collapse
#can_get_class?, #can_set_class?, #get_many_with_keys, #key_cell
Constructor Details
Returns a new instance of HashRepository.
6
7
8
|
# File 'lib/hold/in_memory/hash_repository.rb', line 6
def initialize
@hash = {}
end
|
Instance Method Details
#clear_key(key) ⇒ Object
18
19
20
|
# File 'lib/hold/in_memory/hash_repository.rb', line 18
def clear_key(key)
@hash.delete(key)
end
|
#get_with_key(key) ⇒ Object
14
15
16
|
# File 'lib/hold/in_memory/hash_repository.rb', line 14
def get_with_key(key)
value = @hash[key] and value.dup
end
|
#has_key?(key) ⇒ Boolean
Also known as:
key?
22
23
24
|
# File 'lib/hold/in_memory/hash_repository.rb', line 22
def has_key?(key)
@hash.key?(key)
end
|
#set_with_key(key, value) ⇒ Object
10
11
12
|
# File 'lib/hold/in_memory/hash_repository.rb', line 10
def set_with_key(key, value)
@hash[key] = value
end
|