Class: TypeTracer::TypeSampler

Inherits:
Object
  • Object
show all
Defined in:
lib/type_tracer/type_sampler.rb

Class Method Summary collapse

Class Method Details

.clear_sampled_type_infoObject



28
29
30
# File 'lib/type_tracer/type_sampler.rb', line 28

def clear_sampled_type_info
  @type_info_by_class = {}
end

.sampled_type_infoObject



21
22
23
24
25
26
# File 'lib/type_tracer/type_sampler.rb', line 21

def sampled_type_info
  {
    git_commit: TypeTracer.config.git_commit,
    type_info: @type_info_by_class
  }
end

.startObject



7
8
9
10
11
12
13
14
# File 'lib/type_tracer/type_sampler.rb', line 7

def start
  @project_root ||= TypeTracer.config.type_check_root_path.to_s + '/'
  @sample_path_regex ||= TypeTracer.config.type_check_path_regex
  @ignored_classes ||= Set.new
  @type_info_by_class ||= {}
  @trace ||= TracePoint.new(:call, &method(:trace_method_call))
  @trace.enable
end

.stopObject



16
17
18
19
# File 'lib/type_tracer/type_sampler.rb', line 16

def stop
  return unless @trace && @trace.enabled?
  @trace.disable
end