# File lib/puppet/resource.rb, line 193
193:     def to_transobject
194:         # Now convert to a transobject
195:         result = Puppet::TransObject.new(@reference.title, @reference.type)
196:         to_hash.each do |p, v|
197:             if v.is_a?(Puppet::Resource::Reference)
198:                 v = v.to_trans_ref
199:             elsif v.is_a?(Array)
200:                 v = v.collect { |av|
201:                     if av.is_a?(Puppet::Resource::Reference)
202:                         av = av.to_trans_ref
203:                     end
204:                     av
205:                 }
206:             end
207: 
208:             # If the value is an array with only one value, then
209:             # convert it to a single value.  This is largely so that
210:             # the database interaction doesn't have to worry about
211:             # whether it returns an array or a string.
212:             result[p.to_s] = if v.is_a?(Array) and v.length == 1
213:                               v[0]
214:                           else
215:                               v
216:                           end
217:         end
218: 
219:         result.tags = self.tags
220: 
221:         return result
222:     end