def try_object_promotion(obj)
            return obj unless Origami::OPTIONS[:enable_type_propagation] and @deferred_casts.key?(obj.reference)

            types = @deferred_casts[obj.reference]
            types = [ types ] unless types.is_a?(::Array)

            # Promote object if a compatible type is found.
            cast_type = types.find {|type| type < obj.class }
            if cast_type
                obj = obj.cast_to(cast_type, self)
            else
                obj
            end
        end
def try_object_promotion(obj)
            return obj unless Origami::OPTIONS[:enable_type_propagation] and @deferred_casts.key?(obj.reference)

            types = @deferred_casts[obj.reference]
            types = [ types ] unless types.is_a?(::Array)

            # Promote object if a compatible type is found.
            cast_type = types.find {|type| type < obj.class }
            if cast_type
                obj = obj.cast_to(cast_type, self)
            else
                obj
            end
        end
Attempt to promote an object using the deferred casts.