Sha256: bfdc76ebf2b633ce9316d6cd9203e4ad07c36f403914207e2f9fa8a3849405f7

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

module Errplane
  module Rails
    module Instrumentation
      def self.included(base)
        base.extend(ClassMethods)
      end

      module ClassMethods
        def instrument(methods = [])
          methods = [methods] unless methods.is_a?(Array)
          methods.each do |method|
            ::Rails.logger.debug "OVERRIDING METHOD: #{method}"

            class_eval <<-EVAL_METHOD
              def #{method}_with_instrumentation
                Errplane.report(\"instrumentation/#{self.class}##{method}\")
                #{method}_without_instrumentation
              end
            EVAL_METHOD

            alias_method "#{method}_without_instrumentation", method
            alias_method method, "#{method}_with_instrumentation"
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
errplane-0.5.10 lib/errplane/rails/instrumentation.rb
errplane-0.5.9 lib/errplane/rails/instrumentation.rb
errplane-0.5.8 lib/errplane/rails/instrumentation.rb
errplane-0.5.7 lib/errplane/rails/instrumentation.rb
errplane-0.5.6 lib/errplane/rails/instrumentation.rb