Class: HtmlGen::TextEle
- Inherits:
-
Object
- Object
- HtmlGen::TextEle
- Defined in:
- lib/html_gen/text_ele.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
-
#html(args) ⇒ Object
Returns the text HTML-escaped.
-
#initialize(args) ⇒ TextEle
constructor
A new instance of TextEle.
-
#str ⇒ Object
Returns the text that this element holds.
Constructor Details
#initialize(args) ⇒ TextEle
Returns a new instance of TextEle.
4 5 6 7 8 |
# File 'lib/html_gen/text_ele.rb', line 4 def initialize(args) @str = args[:str] @inden = args[:inden] @nl = args[:nl] end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
2 3 4 |
# File 'lib/html_gen/text_ele.rb', line 2 def args @args end |
Instance Method Details
#html(args) ⇒ Object
Returns the text HTML-escaped.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/html_gen/text_ele.rb', line 16 def html(args) if args[:level] level = args[:level] else level = 0 end if !args.key?(:pretty) or args[:pretty] pretty = true else pretty = false end str = "" str << @inden * level if pretty str << HtmlGen.escape_html(@str) str << @nl if pretty return str end |
#str ⇒ Object
Returns the text that this element holds.
11 12 13 |
# File 'lib/html_gen/text_ele.rb', line 11 def str return @str end |