Pryx 


Three Virtues of a Programmer: Laziness, Impatience, and Hubris. -- Larry Wall, the author of Perl Programming language.
Getting Started
Don't add this gem into bundler's Gemfile.
Instead, install it directly via RubyGems
$ gem install pryx
Then use can use pryx cross all your's project.
Usage
Before use it, you need set RUBYOPT variable.
You can do this two way in a terminal.
$: export RUBYOPT+=' -rpryx'
$: ruby your_file.rb # add pry! in your_file for start pry session
or Run your's code directly use:
$: RUBYOPT+='-rpryx' ruby your_file.rb # add pry! in your_file for start pry session
Then, try add pry! into your's ruby code, then run it, have fun!
Following is a example, assume we have test.rb, it content like this:
# test.rb
3.times do
pry!
puts 'hello'
end
Then, when you run RUBYOPT='-rpryx' ruby test.rb

You can even connect to a pry session started from remote or background process use http connection.

Until now, you've only seen the tip of the iceberg, please have a try.
useful command which added directly to Kernel
Kernel#pry!
start a pry session, this session only can be intercept once if add into a loop. when used with a rails/roda web server, it only intercept one per request.
we have IRB equivalent, named irb!, for use more nice feature, use following code instead:
$: RUBYOPT+='-rpryx_irb' ruby your_file.rb # add irb! in your_file for start pry session
Following feature both available when start a Pry or IRB session:
- Add
next/step/up/downcommand for debug, use break - Add
Kernel#ls1(use ls1 to avoid conflict with pry builtin ls command), see looksee - Use
apfor pretty print. see awesome-print - Use
Clipboard.copyorClipboard.pasteto interactive with system clipboard. see clipboard
Following is pry command available only after start a Pry session:
- Add
$/?command for see source, see pry-doc - pry-remote debug support. you still use
pry!no changes, it will usepry-remoteautomatically if current ruby process was running on backround, then, it will use pry-remote, and listen on 0.0.0.0:9876, Then, you can connect to it from another terminal! see pry-remote - Add
pacommand, see pry-power_assert - Add
hiercommand for print the class hierarchies, see pry-hier - Add
pry-aa_ancestorscommand for print the class hierarchy, see pry-aa_ancestors - Add
up/down/frame/stackcommand, see pry-stack_explorer - Add
yesorycommand, see pry-yes - Add
pry-disam, Check following screenshot for a example:

Kernel#pry1 Kernel#pry2 (sorry for this bad name, please create a issue you have a better one)
pry2 do nothing, but it will be interceptd and start a pry session only after pry1 is running.
I haven use this hack for avoid pry session start on working place.
You know what i means.
Kernel#irb1 Kernel#irb2
IRB equivalent for pry1, pry2 we have irb1 and irb2 too.
Kernel#pry3
It just normal binding.pry, that is, will always be intercept if code can reach.
but above plugins and libraries all correct configured.
we have another Kernel#pry?, which enable pry-state automatically, see pry-state
Add command from command line, rescue, kill-pry-rescue, pryx, irbx, pry!
rescue and kill-pry-rescue come from pry-rescue gem, it not load by default, but you can use rescue command from command line directly.
see pry-rescue
pryx is same as pry, but, with plugins and libraries correct configured.
irbx is same things for irb.
pry! just a alias to pry-remote command, when Kernel#pry! was intercepted in a background process,
you can run pry! directly in terminal connect to it.
if your's pry-remote server started background on another host, or on a container, you man need specify hostname and port, e.g. connnect to 192.168.1.100, with port 9876
$: pry! -s 192.168.1.100 -p 9876
Philosophy
This gem is design to Minimal impact on target ruby code, in fact, after require 'pryx' or RUBYOPT='-rpryx'
(they do same thing), only several instance method be defined on Kernel, and several gems add to $LOAD_PATH,
but not load, ready to require it, no more. so, it should be safe to use it, either affect performance nor
namespace/variables etc.
But, you should only use it in development, though, it was tested is run in container(alpine) too.
Limit
breaknot work well if you add more than one break point, but still usenextgoto the next break point, See https://github.com/gsamokovarov/break/issues/12
Support
- MRI 2.6+
History
See CHANGELOG for details.
Contributing
- Bug reports
- Source
Patches:
- Fork on Github.
- Run
gem install --dev pryxorbundle install. - Create your feature branch:
git checkout -b my-new-feature. - Commit your changes:
git commit -am 'Add some feature'. - Push to the branch:
git push origin my-new-feature. - Send a pull request :D.
Not listed famous pry plugins is welcome!!
license
Released under the MIT license, See LICENSE for details.