Live data from Hacker News

Tossing Out IRB for Pry

philaquilina.com

21–25 of 25 posts

Re: Tossing Out IRB for Pry

#21
This looks great, but the edit feature is not actually something you can't have in IRB. Both my own utility_belt gem from 2007 and another person's sketches gem from 2009 enabled the same functionality.

I think Pry is great, I wrote a little console with it recently for a simple back-end app, and the edit feature looks like your most advanced option for this kind of thing. But for the sake of accuracy, it's not actually 100% brand new functionality. A lot of people have been doing that in IRB for a long time.

Re: Tossing Out IRB for Pry

#22

This looks great, but the edit feature is not actually something you can't have in IRB. Both my own utility_belt gem from 2007 and another person's sketches gem from 2009 enabled the same functionality. I think Pry is great, I wrote a little console with it recently for a simple back-end app, and the edit feature looks like your most advanced option for this kind of thing. But for the sake of accuracy, it's not actua…

The Pry editor feature can do a few things that are impossible in IRB (but correct me if i'm wrong) --- you can call up an editor in the MIDDLE of an incomplete expression, this is only possible because Pry commands are not methods - see here: https://github.com/pry/pry/wiki/User-Input#wiki-Edit_input_b...

Other things the Pry editor feature can do that i haven't seen elsewhere: it can edit methods (`edit-method MyClass#my_method`), it can open up an editor directly on the file/line that caused the last exception (`edit --ex`), it can edit previous expressions (`edit -i EXPR`).

Your interactive_editor gem was inspiration for this though, a very nice little gem :)

Re: Tossing Out IRB for Pry

#23

This looks great, but the edit feature is not actually something you can't have in IRB. Both my own utility_belt gem from 2007 and another person's sketches gem from 2009 enabled the same functionality. I think Pry is great, I wrote a little console with it recently for a simple back-end app, and the edit feature looks like your most advanced option for this kind of thing. But for the sake of accuracy, it's not actua…

The Pry editor feature can do a few things that are impossible in IRB (but correct me if i'm wrong) --- you can call up an editor in the MIDDLE of an incomplete expression, this is only possible because Pry commands are not methods - see here: https://github.com/pry/pry/wiki/User-Input#wiki-Edit_input_b... Other things the Pry editor feature can do that i haven't seen elsewhere: it can edit methods (`edit-method MyCl…

Another approach to editing your code while working in the REPL is to simply send code from your editor to the browser. I recently wrote a blog post about setting vim up for this: http://alanmacdougall.com/blog/2012/03/27/using-vim-slime-wi...

Re: Tossing Out IRB for Pry

#25
post #9
post #6

Earlier quoted context omitted.

In IRB I use flyrb[1], which gives me methods called vi, emacs and mate, that give me this functionality. Incidentally, because I want syntax-highlighting for ruby, I have this in my ~/.irbrc def vim edit_interactively("vim -c 'set ft=ruby'") end [1] - https://github.com/jtrupiano/flyrb

Pry has this functionality built-in but souped-up on a diet of crack: https://github.com/pry/pry/wiki/Editor-integration ;)

Ok. I've switched, was surprisingly easy to integrate with Rails too. Excellent stuff - thanks!
Post reply on HN