Sha256: 86eaa6a3b1c24ba17fd55ac2e3822205ce333c0a3c97ace595239237496fe8e2

Contents?: true

Size: 923 Bytes

Versions: 9

Compression:

Stored size: 923 Bytes

Contents

module Immunio
  module MetalHook
    extend ActiveSupport::Concern

    included do
      if method_defined? :dispatch
        Immunio::Utils.alias_method_chain self, :dispatch, :immunio
      end
    end

    protected

    def dispatch_with_immunio(*args)
      Request.time 'plugin', "#{Module.nesting[0]}::#{__method__}" do
        name, _ = *args

        route_name = "#{controller_path}##{name}"
        Immunio.logger.debug { "MetalHook#dispatch: route_name: #{route_name}" }

        Immunio.run_hook! 'metal', 'framework_route', route_name: route_name

        Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
          dispatch_without_immunio(*args)
        end
      end
    end
  end
end

Immunio::Plugin.load(
  'ActionController (Metal)',
  hooks: %w(framework_route)) do |plugin|
  ActionController::Metal.send :include, Immunio::MetalHook
  plugin.loaded! ActionPack::VERSION::STRING
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
immunio-2.0.4 lib/immunio/plugins/metal.rb
immunio-2.0.3 lib/immunio/plugins/metal.rb
immunio-2.0.2 lib/immunio/plugins/metal.rb
immunio-1.2.1 lib/immunio/plugins/metal.rb
immunio-1.1.19 lib/immunio/plugins/metal.rb
immunio-1.1.18 lib/immunio/plugins/metal.rb
immunio-1.1.16 lib/immunio/plugins/metal.rb
immunio-1.1.15 lib/immunio/plugins/metal.rb
immunio-1.1.13 lib/immunio/plugins/metal.rb