Method: ServiceObject::Errors#to_xml

Defined in:
lib/service_object/errors.rb

#to_xml(options = {}) ⇒ String

Generates XML format errors

errs = ServiceObject::Errors.new
errs.add 'Something is wrong.'
errs.add 'Another is wrong.'
errs.to_xml
=>
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
 <errors>
   <error>Something is wrong.</error>
   <error>Another is wrong.</error>
 </errors>

Returns:

  • (String)

    XML format string



62
63
64
# File 'lib/service_object/errors.rb', line 62

def to_xml(options={})
  super({ root: "errors", skip_types: true }.merge!(options))
end