Module: Immunio::HamlHooks

Extended by:
ActiveSupport::Concern
Defined in:
lib/immunio/plugins/action_view.rb

Overview

Hooks for the HAML template engine.

Instance Method Summary collapse

Instance Method Details

#push_script_with_immunio(code, opts = {}, &block) ⇒ Object



399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/immunio/plugins/action_view.rb', line 399

def push_script_with_immunio(code, opts = {}, &block)
  # Wrap expressions in the templates to track their rendered value.
  Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
    if code !~ BLOCK_EXPR
      # escape if we're told to by HAML
      code = Immunio::Template.generate_render_var_code(code, opts[:escape_html])
    end
    Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
      push_script_without_immunio(code, opts, &block)
    end
  end
end