Class: RedfishClient::NilHash

Inherits:
Object
  • Object
show all
Defined in:
lib/redfish_client/nil_hash.rb

Overview

NilHash imitates the built-in Hash class without storing anything permanently.

Main use of this class is as a non-caching connector backend.

Instance Method Summary collapse

Instance Method Details

#[](_key) ⇒ nil

Access hash member.

Since this implementation does not store any data, return value is always nil.

Parameters:

  • _key

    not used

Returns:

  • (nil)


16
17
18
# File 'lib/redfish_client/nil_hash.rb', line 16

def [](_key)
  nil
end

#[]=(_key, value) ⇒ Object

Set hash member.

This is just a pass-through method, since it always simply returns the value without actually storing it.

Parameters:

  • _key

    not used

  • value (Object)

    any value

Returns:

  • (Object)

    value



28
29
30
# File 'lib/redfish_client/nil_hash.rb', line 28

def []=(_key, value)
  value
end

#clearObject

Clear the contents of the cache.

Since hash is not storing anything, this is a no-op.



35
# File 'lib/redfish_client/nil_hash.rb', line 35

def clear; end

#delete(_key) ⇒ Object

Delete entry from hash.

Since hash is not storing anything, this is a no-op.

Parameters:

  • _key

    not used



42
# File 'lib/redfish_client/nil_hash.rb', line 42

def delete(_key) end