269: def physicalize
270:
271: def build(obj, revision, embedded = false)
272:
273: if obj.is_a?(ObjectStream)
274: obj.each { |subobj|
275: build(subobj, revision, true)
276: }
277: end
278:
279: obj.pre_build
280:
281: case obj
282: when String
283: if not obj.equal?(@encryption_dict[:U]) and not obj.equal?(@encryption_dict[:O]) and not embedded
284: obj.extend(EncryptedString)
285: obj.encryption_key = @encryption_key
286: obj.algorithm = @str_algo
287: end
288:
289: when Stream
290: obj.extend(EncryptedStream)
291: obj.encryption_key = @encryption_key
292: obj.algorithm = @stm_algo
293:
294: when Dictionary, Array
295:
296: obj.map! { |subobj|
297: if subobj.is_indirect?
298: if get_object(subobj.reference)
299: subobj.reference
300: else
301: ref = add_to_revision(subobj, revision)
302: build(subobj, revision, embedded)
303: ref
304: end
305: else
306: subobj
307: end
308: }
309:
310: obj.each { |subobj|
311: build(subobj, revision, embedded)
312: }
313: end
314:
315: obj.post_build
316:
317: end
318:
319: all_indirect_objects.each { |obj, revision|
320: build(obj, revision)
321: }
322:
323: self
324: end