class HtmlSafeString
Simple class that extends strings to do html escapes on incoming concats, only defined if not running under Rails
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/iron/web/string.rb, line 27 def initialize(*args) @html_safe = true super end
Public Instance Methods
+(other)
click to toggle source
# File lib/iron/web/string.rb, line 50 def +(other) dup.concat(other) end
<<(value)
click to toggle source
# File lib/iron/web/string.rb, line 54 def <<(value) concat(value) end
concat(value)
click to toggle source
The magic - escape values that are concatenated onto this string before concatenation.
Calls superclass method
# File lib/iron/web/string.rb, line 42 def concat(value) if !html_safe? || value.html_safe? super(value) else super(Html.escape_once(value)) end end
html_safe()
click to toggle source
# File lib/iron/web/string.rb, line 36 def html_safe self end
html_safe?()
click to toggle source
# File lib/iron/web/string.rb, line 32 def html_safe? @html_safe end