Class: RawXML
Overview
create a string class that doesn’t get escaped when dumped into XML stream
Constant Summary
Constants inherited from String
Instance Method Summary collapse
-
#initialize(string, options = {}) ⇒ RawXML
constructor
A new instance of RawXML.
- #to_xml(options_arg = {}) ⇒ Object
Methods inherited from String
#strip_xml_head, #strip_xml_head!
Constructor Details
#initialize(string, options = {}) ⇒ RawXML
Returns a new instance of RawXML.
52 53 54 55 |
# File 'lib/xml_serialization.rb', line 52 def initialize(string, ={}) @options = super string end |
Instance Method Details
#to_xml(options_arg = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/xml_serialization.rb', line 57 def to_xml(={}) = @options.merge builder = [:builder] || Builder::XmlMarkup.new(:indent => [:indent]) add_tag = .has_key?(:no_tag) ? ![:no_tag] : [:root] return builder.no_tag!(self.strip_xml_head) unless add_tag tag = [:root] || self.class.name.downcase dasherize = ! .has_key?(:dasherize) || [:dasherize] tag = dasherize ? tag.to_s.dasherize : tag builder.raw_tag!(tag, self.strip_xml_head) end |