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