XRBSourceXRBMarkupString

class MarkupString

Initialized from text which is escaped to use HTML entities.

Definitions

def initialize(string = nil, escape = true)

Implementation

def initialize(string = nil, escape = true)
	if string
		if escape
			string = ::CGI.escape_html(string)
		end
		
		super(string)
	else
		super()
	end
end

def self.raw(string)

Generate a valid MarkupString withot any escaping.

Implementation

def self.raw(string)
	self.new(string, false)
end

def html_safe?

This "string" is already escaped, thus it is safe to append to the output buffer. This predicate is used by Rails' ActionView::OutputBuffer to determine if the string should be escaped or not.

Implementation

def html_safe?
	true
end