Sha256: 89ec02aecbf94b6708fafe9b421e7ea113d1d660ba08c716a11189dccaed84e5

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

require "active_support/concern"

require "mengpaneel/manager"

module Mengpaneel
  module Controller
    extend ActiveSupport::Concern

    included do
      if Rails::VERSION::MAJOR >= 5
        prepend_around_action :wrap_in_mengpaneel
      else
        prepend_around_filter :wrap_in_mengpaneel
      end

      delegate :mixpanel, to: :mengpaneel

      helper_method :mengpaneel, :mixpanel
    end

    def mengpaneel
      @mengpaneel ||= Manager.new(self)
    end

    private
      def wrap_in_mengpaneel(&block)
        mengpaneel.wrap do
          yield
        end
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mengpaneel-0.0.3 lib/mengpaneel/controller.rb