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

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

said on

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

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

said on

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

said on

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

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

jakdak: can you be more specific?

said on

hgs: do you already know about ruby-breakpoint?

said on

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

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

kjell:

IRB.conf[:AUTO_INDENT] = true
said on

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

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

said on

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

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.