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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ InMemoryStore

Returns a new instance of InMemoryStore.



15
16
17
# File 'lib/blobby/in_memory_store.rb', line 15

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

Class Method Details

.from_uri(_uri) ⇒ Object



11
12
13
# File 'lib/blobby/in_memory_store.rb', line 11

def self.from_uri(_uri)
  new
end

Instance Method Details

#[](key) ⇒ Object



23
24
25
26
# File 'lib/blobby/in_memory_store.rb', line 23

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

#available?Boolean

Returns:

  • (Boolean)


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

def available?
  true
end