File: //usr/local/rvm/gems/ruby-2.7.4/doc/activesupport-6.1.4.1/ri/Array/to_xml-i.ri
U:RDoc::AnyMethod[iI"to_xml:ETI"Array#to_xml;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"LReturns a string that represents the array in XML by invoking +to_xml+ ;TI"Non each element. Active Record collections delegate their representation ;TI"in XML to this method.;To:RDoc::Markup::BlankLine o;
; [I"KAll elements are expected to respond to +to_xml+, if any of them does ;TI"%not then an exception is raised.;T@o;
; [I"JThe root node reflects the class name of the first element in plural ;TI"Aif all elements belong to the same type and that's not Hash:;T@o:RDoc::Markup::Verbatim; [I"customer.projects.to_xml
;TI"
;TI",<?xml version="1.0" encoding="UTF-8"?>
;TI"<projects type="array">
;TI" <project>
;TI"1 <amount type="decimal">20000.0</amount>
;TI"8 <customer-id type="integer">1567</customer-id>
;TI"7 <deal-date type="date">2008-04-09</deal-date>
;TI"
...
;TI" </project>
;TI" <project>
;TI"1 <amount type="decimal">57230.0</amount>
;TI"8 <customer-id type="integer">1567</customer-id>
;TI"7 <deal-date type="date">2008-04-15</deal-date>
;TI"
...
;TI" </project>
;TI"</projects>
;T:@format0o;
; [I"-Otherwise the root element is "objects":;T@o;; [I"+[{ foo: 1, bar: 2}, { baz: 3}].to_xml
;TI"
;TI",<?xml version="1.0" encoding="UTF-8"?>
;TI"<objects type="array">
;TI" <object>
;TI"% <bar type="integer">2</bar>
;TI"% <foo type="integer">1</foo>
;TI" </object>
;TI" <object>
;TI"% <baz type="integer">3</baz>
;TI" </object>
;TI"</objects>
;T;
0o;
; [I"MIf the collection is empty the root element is "nil-classes" by default:;T@o;; [ I"[].to_xml
;TI"
;TI",<?xml version="1.0" encoding="UTF-8"?>
;TI"!<nil-classes type="array"/>
;T;
0o;
; [I"GTo ensure a meaningful root element use the <tt>:root</tt> option:;T@o;; [ I"Acustomer_with_no_projects.projects.to_xml(root: 'projects')
;TI"
;TI",<?xml version="1.0" encoding="UTF-8"?>
;TI"<projects type="array"/>
;T;
0o;
; [I"XBy default name of the node for the children of root is <tt>root.singularize</tt>. ;TI":You can change it with the <tt>:children</tt> option.;T@o;
; [I",The +options+ hash is passed downwards:;T@o;; [I"*Message.all.to_xml(skip_types: true)
;TI"
;TI",<?xml version="1.0" encoding="UTF-8"?>
;TI"<messages>
;TI" <message>
;TI"< <created-at>2008-03-07T09:58:18+01:00</created-at>
;TI" <id>1</id>
;TI" <name>1</name>
;TI"< <updated-at>2008-03-07T09:58:18+01:00</updated-at>
;TI" <user-id>1</user-id>
;TI" </message>
;TI"</messages>;T;
0:
@fileI"5lib/active_support/core_ext/array/conversions.rb;T:0@omit_headings_from_table_of_contents_below00I"builder;T[ I"(options = {});T@dFI"
Array;TcRDoc::NormalClass00