# File lib/puppet/external/pson/common.rb, line 225
225:   def pretty_generate(obj, opts = nil)
226: 
227:     state = PSON.state.new(
228: 
229:       :indent     => '  ',
230:       :space      => ' ',
231:       :object_nl  => "\n",
232:       :array_nl   => "\n",
233: 
234:       :check_circular => true
235:     )
236:     if opts
237:       if opts.respond_to? :to_hash
238:         opts = opts.to_hash
239:       elsif opts.respond_to? :to_h
240:         opts = opts.to_h
241:       else
242:         raise TypeError, "can't convert #{opts.class} into Hash"
243:       end
244:       state.configure(opts)
245:     end
246:     obj.to_pson(state)
247:   end