Class: Hamlit::Escapable

Inherits:
Temple::Filters::Escapable
  • Object
show all
Defined in:
lib/hamlit/escapable.rb

Direct Known Subclasses

ForceEscapable

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Escapable

Returns a new instance of Escapable.


6
7
8
9
10
11
# File 'lib/hamlit/escapable.rb', line 6

def initialize(opts = {})
  super
  @escape_code = options[:escape_code] ||
    "::Hamlit::Utils.escape_html#{options[:use_html_safe] ? '_safe' : ''}((%s))"
  @escaper = eval("proc {|v| #{@escape_code % 'v'} }")
end