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.
-
#str ⇒ Object
readonly
Returns the text that this element holds.
Instance Method Summary collapse
-
#html(args) ⇒ Object
Returns the text HTML-escaped.
-
#initialize(args) ⇒ TextEle
constructor
A new instance of TextEle.
Constructor Details
#initialize(args) ⇒ TextEle
Returns a new instance of TextEle.
4 5 6 7 8 9 |
# File 'lib/html_gen/text_ele.rb', line 4 def initialize(args) @str = args[:str] @html = args[:html] @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 |
#str ⇒ Object (readonly)
Returns the text that this element holds.
12 13 14 |
# File 'lib/html_gen/text_ele.rb', line 12 def str @str end |
Instance Method Details
#html(args) ⇒ Object
Returns the text HTML-escaped.
15 16 17 18 19 20 21 |
# File 'lib/html_gen/text_ele.rb', line 15 def html(args) str = "" str << @inden * level(args) if pretty?(args) str << html_content str << @nl if pretty?(args) str end |