hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Manners for IRB #

by why in inspect

Okay, well, yesterday’s discussion went pretty positively, so you can throw this file in as your ~/.irbrc and see how you like the inspect changes at least: manners.irbrc.

You could easily hack in object numbering or Proc line numbers if you like. I’ll get back later on the backtrace finesse.

said on 15 Feb 2006 at 11:58

Works fine, but what about fixnums, floats and bignums?

said on 15 Feb 2006 at 12:30

Yeah, it seems to be calling an ugly to_s for Numeric.

Try replacing the Numeric line with:

class Numeric; def inspect(hits = nil) to_s end end
said on 15 Feb 2006 at 12:59

ruby 1.8.2 (2005-04-11), if that’s the problem.

said on 15 Feb 2006 at 15:49

Hmm. Is there a way to distinguish RStruct-based instances from pure Ruby-land?

said on 15 Feb 2006 at 23:17

Who says it would be cool if irb indented your code for you?

I don’t want to go off topic or anything, and don’t want to joke about writing code in irb, but it already knows how deep you’re nested… It couldn’t be that hard to add two spaces to the prompt for each level down you go.

It would make me feel oh-so respected.

said on 16 Feb 2006 at 08:40

My wish would be for a command-line option that would run ruby in a debugger, but only go into debug mode when the program would terminate abnormally. -rdebug doesn’t do that, it goes into the debugger to start with. The reason for this wish is that one could poke around in the scope that caused the problem, see which variables hold what, etc.

said on 16 Feb 2006 at 12:37
debugging :o

the only one thing i don’t like about ruby – i waste quite alot of time debugging ruby. will it be better in 2.0 ? :o

said on 16 Feb 2006 at 15:00

jakdak: can you be more specific?

said on 16 Feb 2006 at 16:03

hgs: do you already know about ruby-breakpoint?

said on 16 Feb 2006 at 16:59

MenTaLguY : In particular I miss the Visual Studio style, step, watch, ‘what are all my variables doing’. Logging out at specific times just doesn’t cut it – and neither does ‘breakpoint’

(note that i am mostly talking about Rails here mind)

said on 17 Feb 2006 at 01:31

jakdak: Don’t waste your time. Start doing unit testing. I don’t understand how people write code in Ruby without any unit testing. There is no compiler for Ruby, you can’t even be sure that you named all your variables correctly.

said on 17 Feb 2006 at 02:42

kjell:

IRB.conf[:AUTO_INDENT] = true
said on 17 Feb 2006 at 03:43

kentuar: yes – i completly get you. something i’ve been thinking about – but to be honest – i don’t really know where to start ! any recommendations on guides ?

said on 27 Feb 2006 at 08:40

Hi. Im a nuub. Which folder do i put manners.irbrc in?? I’m running windows

said on 26 Mar 2006 at 17:38

Chris: ~ is the current users home directory under Linux, UNIX , et al. In Windows (2K/XP) this maps to

%USERPROFILE%

(works via Start > Run)

So, erhm, somewhere under that directory. Good luck finding the exact location…

said on 26 Mar 2006 at 17:43

Chris: Saving manners.irbrc as

%USERPROFILE%/.irbrc

should work. Note that Windows Explorer will probably bug you about the filename (starting with a dot) but saving it from another app (Notepad if you must) should work okay.

Comments are closed for this entry.