Sha256: 54986274f23096942d88dd73f93d4f805b463fbe19f5c21ba1105662cc7a2e69

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

require 'private_please/tracking/trace_point_processor'

module PrivatePlease
  class MethodsCallsTracker
    def self.instance
      @instance ||= new(Config.new)
    end

    def self.reset
      @instance = nil
    end

    # -----
    attr_reader :config

    def initialize(config)
      @config                 = config
      @trace_point_processor  = Tracking::TracePointProcessor.new(config)
    end
    private_class_method :new

    def start_tracking
      tracer.enable
    end

    def stop_tracking
      tracer.disable
    end

    def result
      @trace_point_processor.result
    end

    private

    def tracer
      @_tracer ||= begin
        TracePoint.new do |tp|
          @trace_point_processor.process(tp)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
private_please-0.1.2 lib/private_please/methods_calls_tracker.rb
private_please-0.1.1 lib/private_please/methods_calls_tracker.rb
private_please-0.1.0 lib/private_please/methods_calls_tracker.rb