Module: XmlFormatter
- Defined in:
- lib/xml_formatter.rb
Instance Method Summary collapse
Instance Method Details
#to_xml(options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/xml_formatter.rb', line 2 def to_xml( = {}) [:indent] ||= 2 xml = [:builder] ||= Builder::XmlMarkup.new(:indent => [:indent]) xml.instruct! unless [:skip_instruct] xml.tag!(self.class.name.downcase.to_sym, self.attributes) do self.class.reflect_on_all_associations.to_a.each do |assoc| xml.tag!(assoc.name) end end end |