def trans(obj)
if obj.is_a?(Hash)
raise StandardError.new("No input environment available to find model element.") unless @env_in
obj = @env_in.find(obj)
end
return nil if obj.nil?
return obj if obj.is_a?(TrueClass) or obj.is_a?(FalseClass) or obj.is_a?(Numeric) or obj.is_a?(Symbol)
return @transformer_results[obj] if @transformer_results[obj]
return @transformer_results[obj] = obj.dup if obj.is_a?(String)
return obj.collect{|o| trans(o)}.compact if obj.is_a? Array
raise StandardError.new("No transformer for class #{obj.class.name}") unless _transformerBlock(obj.class)
block_desc = _evaluateCondition(obj)
return nil unless block_desc
@transformer_results[obj] = _instantiateTargetClass(obj, block_desc.target)
@transformer_jobs << TransformerJob.new(self, obj, block_desc)
return @transformer_results[obj] if @transformer_jobs.size > 1
while @transformer_jobs.size > 0
@transformer_jobs.first.execute
@transformer_jobs.shift
end
@transformer_results[obj]
end