Class: Representative::Xml
- Inherits:
-
AbstractXml
- Object
- Base
- AbstractXml
- Representative::Xml
- Defined in:
- lib/representative/xml.rb
Overview
Easily generate XML while traversing an object-graph.
Instance Method Summary collapse
-
#comment(text) ⇒ Object
Generate a comment.
-
#initialize(xml_builder, subject = nil, options = {}) {|_self| ... } ⇒ Xml
constructor
Create an XML-generating Representative.
Methods inherited from AbstractXml
Methods inherited from Base
#current_subject, #representing
Constructor Details
#initialize(xml_builder, subject = nil, options = {}) {|_self| ... } ⇒ Xml
Create an XML-generating Representative. The first argument should be an instance of Builder::XmlMarkup (or something that implements it’s interface). The second argument if any, is the initial #subject of representation.
16 17 18 19 20 |
# File 'lib/representative/xml.rb', line 16 def initialize(xml_builder, subject = nil, = {}) @xml = xml_builder super(subject, ) yield self if block_given? end |
Instance Method Details
#comment(text) ⇒ Object
Generate a comment
24 25 26 |
# File 'lib/representative/xml.rb', line 24 def comment(text) @xml.comment!(text) end |