Method: Arrow::Template::URLEncodeDirective#render

Defined in:
lib/arrow/template/urlencode.rb

#render(template, scope) ⇒ Object

Render the content and return it as URL-escaped text.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/arrow/template/urlencode.rb', line 33

def render( template, scope )
	rawary = super
	rary = []

	# Try our best to skip debugging comments
	if template._config[:debuggingComments]
		rary.push( rawary.shift ) if /^<!--.*-->$/ =~ rawary.first
	end

	rawary.each do |line|
		rary << line.to_s.gsub( NonUricRegexp ) do |match|
			"%%%02x" % [ match[0] ]
		end
	end

	return rary
end