Sha256: 0528808d24be54fb1670bc346848e58b6331a98ca40dd247c66ee363c7f70a28

Contents?: true

Size: 1.35 KB

Versions: 39

Compression:

Stored size: 1.35 KB

Contents

# Copied largely from activerecord/lib/active_record/log_subscriber.rb
module ActiveGraph
  module Core
    module Logging
      class << self
        def first_external_path_and_line(callstack)
          line = callstack.find do |frame|
            frame.absolute_path && !ignored_callstack(frame.absolute_path)
          end

          offending_line = line || callstack.first

          [offending_line.path,
           offending_line.lineno]
        end

        NEO4J_CORE_GEM_ROOT = File.expand_path('../../..', __dir__) + '/'

        def ignored_callstack(path)
          paths_to_ignore.any?(&path.method(:start_with?))
        end

        def paths_to_ignore
          @paths_to_ignore ||= [NEO4J_CORE_GEM_ROOT,
                                RbConfig::CONFIG['rubylibdir'],
                                neo4j_gem_path,
                                active_support_gem_path].compact
        end

        def neo4j_gem_path
          return if !defined?(::Rails.root)

          @neo4j_gem_path ||= File.expand_path('../../..', ActiveGraph::Base.method(:driver).source_location[0])
        end

        def active_support_gem_path
          return if !defined?(::ActiveSupport::Notifications)

          @active_support_gem_path ||= File.expand_path('../../..', ActiveSupport::Notifications.method(:subscribe).source_location[0])
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.4 lib/active_graph/core/logging.rb
activegraph-11.5.0.beta.3 lib/active_graph/core/logging.rb
activegraph-12.0.0.beta.3 lib/active_graph/core/logging.rb
activegraph-12.0.0.beta.2 lib/active_graph/core/logging.rb
activegraph-11.5.0.beta.2 lib/active_graph/core/logging.rb
activegraph-12.0.0.beta.1 lib/active_graph/core/logging.rb
activegraph-11.5.0.beta.1 lib/active_graph/core/logging.rb
activegraph-11.5.0.alpha.1 lib/active_graph/core/logging.rb
activegraph-11.4.0 lib/active_graph/core/logging.rb
activegraph-11.3.1 lib/active_graph/core/logging.rb
activegraph-11.3.0 lib/active_graph/core/logging.rb
activegraph-11.2.0 lib/active_graph/core/logging.rb
activegraph-11.1.0 lib/active_graph/core/logging.rb
activegraph-11.1.0.beta.1 lib/active_graph/core/logging.rb
activegraph-11.1.0.alpha.4 lib/active_graph/core/logging.rb
activegraph-11.1.0.alpha.3 lib/active_graph/core/logging.rb
activegraph-11.1.0.alpha.2 lib/active_graph/core/logging.rb
activegraph-11.1.0.alpha.1 lib/active_graph/core/logging.rb
activegraph-10.2.0.beta.1 lib/active_graph/core/logging.rb
activegraph-11.0.2-java lib/active_graph/core/logging.rb