Class: Mova::Storage::Readonly

Inherits:
Object
  • Object
show all
Defined in:
lib/mova/storage/readonly.rb

Overview

Wrapper around a storage that protects from writes.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storage) ⇒ Readonly

Returns a new instance of Readonly.

Since:

  • 0.1.0



9
10
11
# File 'lib/mova/storage/readonly.rb', line 9

def initialize(storage)
  @storage = storage
end

Instance Attribute Details

#storageObject (readonly)

Since:

  • 0.1.0



7
8
9
# File 'lib/mova/storage/readonly.rb', line 7

def storage
  @storage
end

Instance Method Details

#clearvoid

Note:

Does nothing

This method returns an undefined value.

Since:

  • 0.1.0



42
43
# File 'lib/mova/storage/readonly.rb', line 42

def clear
end

#exist?(key) ⇒ Boolean

Parameters:

  • key (String)

Returns:

  • (Boolean)

Since:

  • 0.1.0



27
28
29
# File 'lib/mova/storage/readonly.rb', line 27

def exist?(key)
  storage.exist?(key)
end

#read(key) ⇒ String?

Parameters:

  • key (String)

Returns:

  • (String, nil)

Since:

  • 0.1.0



15
16
17
# File 'lib/mova/storage/readonly.rb', line 15

def read(key)
  storage.read(key)
end

#read_multi(*keys) ⇒ Hash{String => String}

Parameters:

  • keys (*Array<String>)

Returns:

  • (Hash{String => String})

Since:

  • 0.1.0



21
22
23
# File 'lib/mova/storage/readonly.rb', line 21

def read_multi(*keys)
  storage.read_multi(*keys)
end

#write(key, value) ⇒ void

Note:

Does nothing

This method returns an undefined value.

Parameters:

  • key (String)
  • value (String, nil)

Since:

  • 0.1.0



36
37
# File 'lib/mova/storage/readonly.rb', line 36

def write(key, value)
end