Class: Blobby::InMemoryStore

Inherits:
Object
  • Object
show all
Defined in:
lib/blobby/in_memory_store.rb

Overview

A BLOB store backed by a Hash.

Defined Under Namespace

Classes: StoredObject

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ InMemoryStore

Returns a new instance of InMemoryStore.



9
10
11
# File 'lib/blobby/in_memory_store.rb', line 9

def initialize(hash = {})
  @hash = hash
end

Instance Method Details

#[](key) ⇒ Object



17
18
19
20
# File 'lib/blobby/in_memory_store.rb', line 17

def [](key)
  KeyConstraint.must_allow!(key)
  StoredObject.new(@hash, key)
end

#available?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/blobby/in_memory_store.rb', line 13

def available?
  true
end