223: def physicalize
224:
225: def build(obj, revision)
226:
227: obj.pre_build
228:
229: case obj
230: when String
231: if not obj.equal?(@encryption_dict[:U]) and not obj.equal?(@encryption_dict[:O])
232: obj.extend(EncryptedString)
233: obj.encryption_key = @encryption_key
234: obj.algorithm = @str_algo
235: end
236:
237: when Stream
238: obj.extend(EncryptedStream)
239: obj.encryption_key = @encryption_key
240: obj.algorithm = @stm_algo
241:
242: when Dictionary, Array
243:
244: obj.map! { |subobj|
245: if subobj.is_indirect?
246: if get_object(subobj.reference)
247: subobj.reference
248: else
249: ref = add_to_revision(subobj, revision)
250: build(subobj, revision)
251: ref
252: end
253: else
254: subobj
255: end
256: }
257:
258: obj.each { |subobj|
259: build(subobj, revision)
260: }
261: end
262:
263: obj.post_build
264:
265: end
266:
267: all_indirect_objects.each { |obj, revision|
268: build(obj, revision)
269: }
270:
271: self
272: end