try
try copied to clipboard
Fix bin/try to work with gem installation
Summary
Fix bin/try to properly set $0 when loading try.rb, ensuring gem installation works correctly
Problem
When installed as a gem, try.rb uses $0 to determine its own script path (line 996: script_path = File.expand_path($0)). The previous require_relative '../try' approach left $0 pointing to bin/try
instead of try.rb, breaking self-referential path logic.
Solution
Replace require_relative with explicit $0 assignment and load:
$0 = File.expand_path('../try.rb', __dir__)
load $0
This ensures try.rb sees the correct path in $0 whether run locally or via gem installation.