Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IRB integration #13

Merged
merged 2 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# frozen_string_literal: true

require "bundler/setup"
require "tracer/irb"
require "tracer"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
10 changes: 9 additions & 1 deletion lib/tracer/irb.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
require_relative "../tracer"
require "irb/cmd/nop"
require "irb"

if Gem::Version.new(IRB::VERSION) < Gem::Version.new("1.6.0")
warn <<~MSG
Your version of IRB is too old so Tracer cannot register its commands.
Please upgrade IRB by adding `gem "irb", "~> 1.6.0"` to your Gemfile.
MSG

return
end

module Tracer
def self.register_irb_commands
ec = IRB::ExtendCommandBundle.instance_variable_get(:@EXTEND_COMMANDS)
Expand Down