Sha256: 64e818899992c4c367ceee15b08ef07a480356a82c8c5a026f6f4e03c64ce8e8

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

# frozen_string_literal: true

module Lecter
  class TracePoint
    def build
      tp = ::TracePoint.new(:line, :class, :call, :c_call, :return) do |trace_point|
        if trace_point.path&.exclude?('/app/views') &&
           trace_point.path&.exclude?('/app/helpers') &&
           trace_point.path&.include?(Rails.root.to_s) &&
           trace_point.method_id != :method_added &&
           trace_point.defined_class != Module &&
           trace_point.defined_class != Class &&
           trace_point.defined_class != String &&
           trace_point.defined_class != Kernel &&
           trace_point.defined_class != NilClass

          Thread.current[:items] += [
            trace_point.path,
            trace_point.lineno,
            trace_point.defined_class,
            trace_point.method_id,
            trace_point.event
          ].join(' ') + ';'
        end
      end

      tp
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lecter-0.2.0 lib/lecter/trace_point.rb