Hacker News new | past | comments | ask | show | jobs | submit login
Tossing Out IRB for Pry (philaquilina.com)
113 points by philaquilina on May 18, 2012 | hide | past | favorite | 23 comments



One of the coolest things about pry is how it doesn't need to monkey-patch Object in order to add custom functionality. The command-system stands above the ruby level.


just a note, irb always supported something like pry's "cd", through pushws/popws. This does not make pry less awesome.


Too bad a search on "IRB" turns up mainly "institutional review board."


Pry also has a bunch of plugins available including smalltalk-like error consoles and multi-user remote debugging sessions. See here for more info: http://banisterfiend.wordpress.com/2012/02/14/the-pry-ecosys...


About half of our developer group has made the change in the last month and everyone seems to love it.

There's a brief Railscast on it as well: http://railscasts.com/episodes/280-pry-with-rails


Are you by any chance Maltese, or do you have Maltese parents? Just deducing from your last name and the 8 pointed flag favicon for your blog.


Good eye! I am indeed half maltese. Although atheist, I've always subscribed to the (secular) symbolism of the the 8 points on the cross, so I thought it a good symbol for the site.


Well, I am Maltese myself, so it was a surprise to see another Maltese on hackernews. Props!


Half Maltese here too!


This looks really nice, but what I would like even more would be to just jump out into a minimal multi line edit mode between the "def" and "end" of a method.


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!


Question:

  [19] (pry) main / Pry: 1> cd ..
  [20] (pry) main / Pry: 0>
Shouldn't 'cd..' take you out of the Pry scope?


Ha yea, there's a typo there. The gist is cached by the wordpress plugin. Going to fix it at lunch.

Should look like this: [20] (pry) main: 0>


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.


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 :)


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...


Nice and all, but I clicked the link wondering why Institutional Review Boards were being tossed, seeing as how they're required by federal law to oversee ethics in research at publicly funded universities.


Context clues.

If I was in a sportsbar and heard someone dissing the NFL, I wouldn't think "What do they have against the National Forensics League?"

On HN, if you see an acronym where it doesn't make sense to you, great! Most likely you're being presented the opportunity to learn about some cool technology.


I did (learn something), but not knowing what "Py" was, there were no other context clues in the headline. HN is friendly to researchers too, so the setting is appropriate for the other interpretation of the acronym (and makes the football analogy mildly condescending).


But accurate.


Don't feel bad, you weren't the only one. When I first read the title I already read it as "Institutional Review Board", whose paperwork requirements normally increases my blood pressure by several points.

Opening the URL made it obvious what it was referring to, however. And then I immediately installed the package to try it out.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: