24 comments

[ 3.0 ms ] story [ 54.6 ms ] thread
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
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).
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.

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."
Question:

  [19] (pry) main / Pry: 1> cd ..
  [20] (pry) main / Pry: 0>
Shouldn't 'cd..' take you out of the Pry scope?
(comment deleted)
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>

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