Class: HtmlGen::TextEle

Inherits:
Object
  • Object
show all
Defined in:
lib/html_gen/text_ele.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



2
3
4
# File 'lib/html_gen/text_ele.rb', line 2

def args
  @args
end

#strObject (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