Method: Cosmos::Model.get

Defined in:
lib/cosmos/models/model.rb

.get(primary_key, name:) ⇒ Hash|nil

Returns Hash of this model or nil if name not found under primary_key.

Returns:

  • (Hash|nil)

    Hash of this model or nil if name not found under primary_key



38
39
40
41
42
43
44
45
# File 'lib/cosmos/models/model.rb', line 38

def self.get(primary_key, name:)
  json = store.hget(primary_key, name)
  if json
    return JSON.parse(json)
  else
    return nil
  end
end