Class: Glue::XmlBuilder

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

Nitro::FormHelper::FormXmlBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#targetObject

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_sObject



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

def to_s
  @target.to_s
end