class Rhtml::Html
Public Class Methods
new(content='', indent=0, &b)
click to toggle source
# File lib/rhtml/html.rb, line 3 def initialize(content='', indent=0, &b) @__indent = 0 @__content = content @__cls = nil @__id = nil instance_eval(&b) if block_given? end
Public Instance Methods
raw!(string='')
click to toggle source
# File lib/rhtml/html.rb, line 49 def raw! string='' @__content << string.to_s << "\n" end
Also aliased as: ==
tag!(tag_name, ps={}, str=nil, &b)
click to toggle source
# File lib/rhtml/html.rb, line 11 def tag!(tag_name, ps={}, str=nil, &b) str, ps = ps, {} if ps.is_a? String ps[:class] = @__cls if @__cls ps[:id] = @__id if @__id @__content << Rhtml.tag_open(tag_name, ps, @__indent) @__cls = @__id = nil @__indent += 1 if str @__content << INDENT * @__indent << str << "\n" elsif block_given? ret = instance_eval &b @__content << INDENT * @__indent << ret.to_s << "\n" if ret.is_a?(String) end @__indent -= 1 @__content << Rhtml.tag_close(tag_name, @__indent) self end
to_s()
click to toggle source
# File lib/rhtml/html.rb, line 54 def to_s @__content end
void_tag!(tag_name, ps={})
click to toggle source
# File lib/rhtml/html.rb, line 32 def void_tag!(tag_name, ps={}) @__content << Rhtml.void_tag(tag_name, ps, @__indent) self end