Class: Glue::XmlBuilder

Inherits:
Object
  • Object
show all
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

Raw::FormHelper::FormXmlBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#targetObject

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_sObject



120
121
122
# File 'lib/raw/helper/xml.rb', line 120

def to_s
  @target.to_s
end