Class: Cheri::Xml::TextElem
- Inherits:
-
Object
- Object
- Cheri::Xml::TextElem
- Includes:
- Builder::MarkupLikeBuilder, XmlBuilder
- Defined in:
- lib/cheri/builder/xml/element.rb
Direct Known Subclasses
Constant Summary
Constants included from XmlBuilder
Instance Method Summary collapse
-
#initialize(ctx, *r, &k) ⇒ TextElem
constructor
A new instance of TextElem.
- #mod ⇒ Object
-
#to_io(ios) ⇒ Object
Appends content to
ios
. -
#to_s(str = '') ⇒ Object
Appends content to
str
, or to an empty string ifstr
is omitted.
Methods included from XmlBuilder
Constructor Details
#initialize(ctx, *r, &k) ⇒ TextElem
Returns a new instance of TextElem.
117 118 119 120 |
# File 'lib/cheri/builder/xml/element.rb', line 117 def initialize(ctx,*r,&k) @opt = ctx[:xml_opts] || {} super end |
Instance Method Details
#mod ⇒ Object
127 128 129 |
# File 'lib/cheri/builder/xml/element.rb', line 127 def mod Cheri::Xml end |
#to_io(ios) ⇒ Object
Appends content to ios
. Returns the result.
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/cheri/builder/xml/element.rb', line 146 def to_io(ios) @cont.each do |c| if String === c ios << esc(c) else ios << esc(c.to_s) end end if @cont ios end |
#to_s(str = '') ⇒ Object
Appends content to str
, or to an empty string if str
is omitted. Returns the result.
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/cheri/builder/xml/element.rb', line 133 def to_s(str='') return to_io(str) unless String === str @cont.each do |c| if String === c esc(c,str) else esc(c.to_s,str) end end if @cont str end |