P
Peter B.
Hi, I'm new to this newsgroup, so I'm not sure if this is the right
place to ask.
Ok, so what I'm trying to do is customise the IRB prompt in a rather
complicated way: I want to print %i*2 (or even just %i) spaces at the
beginning of each line of prompt. Here was my best attempt (not sure
if there's a better way to format this for Usenet):
IRB.conf[ROMPT][:INDENTS] = {
ROMPT_I => "#{%i.times {print ' '}} >> ",
ROMPT_S => "#{%i.times {print ' '}} >> ",
ROMPT_C => "#{%i.times {print ' '}} >> ",
:RETURN => "=> %s\n"
}
So, what I want it do is like this:
But obviously, It tries to work out the value of the #{ } as soon as
it's set, not when it's displayed, after the %i has been gsub'd for
displaying. So, I get an error thrown at me.
Does anybody know how to do this? Maybe some printf() trickery?
Thanks in advance.
place to ask.
Ok, so what I'm trying to do is customise the IRB prompt in a rather
complicated way: I want to print %i*2 (or even just %i) spaces at the
beginning of each line of prompt. Here was my best attempt (not sure
if there's a better way to format this for Usenet):
IRB.conf[ROMPT][:INDENTS] = {
ROMPT_I => "#{%i.times {print ' '}} >> ",
ROMPT_S => "#{%i.times {print ' '}} >> ",
ROMPT_C => "#{%i.times {print ' '}} >> ",
:RETURN => "=> %s\n"
}
So, what I want it do is like this:
But obviously, It tries to work out the value of the #{ } as soon as
it's set, not when it's displayed, after the %i has been gsub'd for
displaying. So, I get an error thrown at me.
Does anybody know how to do this? Maybe some printf() trickery?
Thanks in advance.