Class: Cheri::Html::TextElem
- Inherits:
-
Object
- Object
- Cheri::Html::TextElem
- Includes:
- Builder::MarkupLikeBuilder, HtmlBuilder
- Defined in:
- lib/cheri/builder/html/element.rb
Direct Known Subclasses
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 ifstris omitted.
Methods included from HtmlBuilder
Constructor Details
#initialize(ctx, *r, &k) ⇒ TextElem
Returns a new instance of TextElem.
109 110 111 112 |
# File 'lib/cheri/builder/html/element.rb', line 109 def initialize(ctx,*r,&k) @opt = ctx[:html_opts] || {} super end |
Instance Method Details
#mod ⇒ Object
119 120 121 |
# File 'lib/cheri/builder/html/element.rb', line 119 def mod Cheri::Html end |
#to_io(ios) ⇒ Object
Appends content to ios. Returns the result.
138 139 140 141 142 143 144 145 146 147 |
# File 'lib/cheri/builder/html/element.rb', line 138 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.
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/cheri/builder/html/element.rb', line 125 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 |