Class: Glue::XmlBuilder
- Inherits:
-
Object
- Object
- Glue::XmlBuilder
- Includes:
- Raw::XmlHelper
- Defined in:
- lib/raw/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
Methods included from Raw::XmlHelper
#comment!, #end_tag!, #method_missing, #processing_instruction!, #start_tag!, #text!
Constructor Details
#initialize(target = '') ⇒ XmlBuilder
Returns a new instance of XmlBuilder.
112 113 114 |
# File 'lib/raw/helper/xml.rb', line 112 def initialize(target = '') @target = target end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Raw::XmlHelper
Instance Attribute Details
#target ⇒ Object
The target receives the generated xml, should respond_to :<<
110 111 112 |
# File 'lib/raw/helper/xml.rb', line 110 def target @target end |
Instance Method Details
#<<(str) ⇒ Object
116 117 118 |
# File 'lib/raw/helper/xml.rb', line 116 def << (str) @target << str end |
#to_s ⇒ Object
120 121 122 |
# File 'lib/raw/helper/xml.rb', line 120 def to_s @target.to_s end |