Start an interactive Ruby session (IRB) with project context loaded
Launches an interactive Ruby session with project context and dependencies loaded.
/plugin marketplace add bastos/ruby-plugin-marketplace/plugin install ruby@ruby-plugin-marketplace[file or expression]Launch an interactive Ruby session with the project context loaded.
The user may provide:
# With bundler context
bundle exec irb
# With project files
bundle exec irb -r ./lib/project_name
bundle exec irb -r ./path/to/file.rb
ruby -e "puts [1,2,3].map { |n| n * 2 }.inspect"
Check if Pry is installed and prefer it for better debugging:
# Check for Pry
bundle info pry 2>/dev/null && bundle exec pry || bundle exec irb
Before starting the session:
Check for common entry points:
lib/<project_name>.rbconfig/environment.rb (Rails-like)Gemfile (ensure bundler context)Suggest useful requires based on project:
require 'bundler/setup'
require 'your_gem'
Suggest these IRB features when relevant:
# Show methods on an object
obj.methods.grep(/pattern/)
# Show source location
method(:method_name).source_location
# Pretty print
require 'pp'
pp complex_object
# Reload a file
load './lib/file.rb'
/ruby:irb # Start basic session
/ruby:irb lib/my_gem.rb # Load specific file
/ruby:irb "[1,2,3].sum" # Evaluate expression