Sha256: 12f5eb871d66f63b026da88c8e27087c1c57f8fa1c2a6a7882f970b0ee35bafd

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true
#
#   irb/lib/tracer.rb -
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# Loading the gem "tracer" will cause it to extend IRB commands with:
# https://github.com/ruby/tracer/blob/v0.2.2/lib/tracer/irb.rb
begin
  require "tracer"
rescue LoadError
  $stderr.puts "Tracer extension of IRB is enabled but tracer gem wasn't found."
  return # This is about to disable loading below
end

module IRB
  class CallTracer < ::CallTracer
    IRB_DIR = File.expand_path('../..', __dir__)

    def skip?(tp)
      super || tp.path.match?(IRB_DIR) || tp.path.match?('<internal:prelude>')
    end
  end
  class WorkSpace
    alias __evaluate__ evaluate
    # Evaluate the context of this workspace and use the Tracer library to
    # output the exact lines of code are being executed in chronological order.
    #
    # See https://github.com/ruby/tracer for more information.
    def evaluate(statements, file = __FILE__, line = __LINE__)
      if IRB.conf[:USE_TRACER] == true
        CallTracer.new(colorize: Color.colorable?).start do
          __evaluate__(statements, file, line)
        end
      else
        __evaluate__(statements, file, line)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/irb-1.14.0/lib/irb/ext/tracer.rb
irb-1.14.3 lib/irb/ext/tracer.rb
irb-1.14.2 lib/irb/ext/tracer.rb
irb-1.14.1 lib/irb/ext/tracer.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/irb-1.13.2/lib/irb/ext/tracer.rb
irb-1.14.0 lib/irb/ext/tracer.rb
irb-1.13.2 lib/irb/ext/tracer.rb
irb-1.13.1 lib/irb/ext/tracer.rb
irb-1.13.0 lib/irb/ext/tracer.rb
irb-1.12.0 lib/irb/ext/tracer.rb