Module: SimpleSerializer

Included in:
Fixnum, String, Symbol
Defined in:
lib/xml_serialization.rb

Instance Method Summary collapse

Instance Method Details

#to_xml(options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/xml_serialization.rb', line 8

def to_xml(options={})
  builder = options[:builder] || Builder::XmlMarkup.new(:indent => options[:indent])
  tag = options[:root] || self.class.name.downcase
  dasherize = ! options.has_key?(:dasherize) || options[:dasherize]
  tag = dasherize ? tag.to_s.dasherize : tag
  builder.tag!(tag, self.to_s)
end