class JSONApi::Deserializer::Store

Public Class Methods

new() click to toggle source
# File lib/jsonapi_deserializer.rb, line 42
def initialize
  @db = {}
end

Public Instance Methods

get(type, id, lid) click to toggle source
# File lib/jsonapi_deserializer.rb, line 53
def get(type, id, lid)
  per_type = @db[type]
  return nil unless per_type

  identifier = id || lid
  per_type[identifier.to_s]
end
set(type, id, lid, record) click to toggle source
# File lib/jsonapi_deserializer.rb, line 46
def set(type, id, lid, record)
  per_type = @db[type] ||= {}
  identifier = id || lid

  per_type[identifier.to_s] = record
end