Class: Glue::XmlBuilder
- Inherits:
-
Object
- Object
- Glue::XmlBuilder
- Includes:
- XmlHelper
- Defined in:
- lib/nitro/helper/xml.rb
Overview
A class that encapsulats the XML generation functionality. Utilizes duck typing to redirect output to a target buffer.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#target ⇒ Object
The target receives the generated xml, should respond_to :<<.
Instance Method Summary collapse
- #<<(str) ⇒ Object
-
#initialize(target = '') ⇒ XmlBuilder
constructor
A new instance of XmlBuilder.
- #to_s ⇒ Object
Constructor Details
#initialize(target = '') ⇒ XmlBuilder
Returns a new instance of XmlBuilder.
112 113 114 |
# File 'lib/nitro/helper/xml.rb', line 112 def initialize(target = '') @target = target end |
Instance Attribute Details
#target ⇒ Object
The target receives the generated xml, should respond_to :<<
110 111 112 |
# File 'lib/nitro/helper/xml.rb', line 110 def target @target end |
Instance Method Details
#<<(str) ⇒ Object
116 117 118 |
# File 'lib/nitro/helper/xml.rb', line 116 def << (str) @target << str end |
#to_s ⇒ Object
120 121 122 |
# File 'lib/nitro/helper/xml.rb', line 120 def to_s @target.to_s end |