Escape dynamic or static expressions. This filter must be used after Temple::HTML::* and before the generators. It can be enclosed with Temple::Filters::DynamicInliner filters to reduce calls to Temple::Utils#escape_html.
@api public
# File lib/temple/filters/escapable.rb, line 15 def initialize(opts = {}) super @escape_code = options[:escape_code] || "::Temple::Utils.escape_html#{options[:use_html_safe] ? '_safe' : ''}((%s))" @escaper = eval("proc {|v| #{@escape_code % 'v'} }") @escape = false end
# File lib/temple/filters/escapable.rb, line 35 def on_dynamic(value) [:dynamic, @escape ? @escape_code % value : value] end
Generated with the Darkfish Rdoc Generator 2.