Manners for IRB #
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.
Pan
Works fine, but what about fixnums, floats and bignums?
grant
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
grant
ruby 1.8.2 (2005-04-11), if that’s the problem.
MenTaLguY
Hmm. Is there a way to distinguish
RStruct
-based instances from pure Ruby-land?kjell
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.
hgs
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.
jakdak
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
MenTaLguY
jakdak: can you be more specific?
toupeira
hgs: do you already know about ruby-breakpoint?
jakdak
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)
kentuar
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.
roo
kjell:
jakdak
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 ?
Chris
Hi. Im a nuub. Which folder do i put manners.irbrc in?? I’m running windows
XoloX
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…
XoloX
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.