Module: RequireProfiler::RubyProfiling

Defined in:
lib/require_profiler/ruby_profiling.rb

Overview

This module contains helpers to activate specific files loading profiling using Stackprof or Vernier (so you can dig deeper into why a particular file is slow to require)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enabledObject

Returns the value of attribute enabled.



9
10
11
# File 'lib/require_profiler/ruby_profiling.rb', line 9

def enabled
  @enabled
end

.profilerObject

Returns the value of attribute profiler.



9
10
11
# File 'lib/require_profiler/ruby_profiling.rb', line 9

def profiler
  @profiler
end

.target_pathObject

Returns the value of attribute target_path.



9
10
11
# File 'lib/require_profiler/ruby_profiling.rb', line 9

def target_path
  @target_path
end

Class Method Details

.capture(path) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/require_profiler/ruby_profiling.rb', line 15

def capture(path, &)
  return yield unless path.end_with?(target_path)

  if profiler == :stackprof
    capture_stackprof(path, &)
  end
end

.enabled?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/require_profiler/ruby_profiling.rb', line 11

def enabled?
  @enabled
end