Module: Profiler::Instrumentation::IrbInstrumentation

Defined in:
lib/profiler/instrumentation/irb_instrumentation.rb

Constant Summary collapse

IRB_SKIP_COMMANDS =
%w[exit quit exit! irb help].freeze

Instance Method Summary collapse

Instance Method Details

#evaluate(line, line_no, *args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/profiler/instrumentation/irb_instrumentation.rb', line 8

def evaluate(line, line_no, *args)
  Profiler.env_override_store.apply!
  stripped = line.to_s.strip
  skip = !Profiler.enabled? ||
         !Profiler.configuration.track_console ||
         stripped.empty? ||
         IRB_SKIP_COMMANDS.include?(stripped)
  return super if skip

  Profiler::ConsoleProfiler.profile(expression: stripped) { super }
end