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



364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/immunio/plugins/action_view.rb', line 364

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