Method: PEROBS::Hash#_deserialize

Defined in:
lib/perobs/Hash.rb

#_deserialize(data) ⇒ Object

Restore the persistent data from a single data structure. This is a library internal method. Do not use outside of this library.

Parameters:

  • data (Hash)

    the actual Hash object



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/perobs/Hash.rb', line 179

def _deserialize(data)
  @data = {}

  data.each do |k, v|
    # References to other PEROBS Objects are marshalled with our own
    # format. If we detect such a marshalled String we convert it into a
    # POXReference object.
    if (match = /^#<PEROBS::POReference id=([0-9]+)>$/.match(k))
      k = POXReference.new(@store, match[1].to_i)
    end
    dv = v.is_a?(POReference) ? POXReference.new(@store, v.id) : v
    @data[k] = dv
  end

  @data
end