BaseSecrete/rorvswild

View on GitHub
lib/rorvswild/plugin/action_mailer.rb

Summary

Maintainability
A
0 mins
Test Coverage
module RorVsWild
  module Plugin
    class ActionMailer
      def self.setup
        return if @installed
        return unless defined?(::ActiveSupport::Notifications.subscribe)
        ActiveSupport::Notifications.subscribe("deliver.action_mailer", new)
        @installed = true
      end

      def start(name, id, payload)
        RorVsWild::Section.start
      end

      def finish(name, id, payload)
        RorVsWild::Section.stop do |section|
          section.command = payload[:mailer]
          section.kind = "mail".freeze
        end
      end
    end
  end
end