From: "Peter B." Date: 2007-02-18T04:25:13+09:00 Subject: Help with customising the IRB prompt 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[:PROMPT][:INDENTS] = { :PROMPT_I => "#{%i.times {print ' '}} >> ", :PROMPT_S => "#{%i.times {print ' '}} >> ", :PROMPT_C => "#{%i.times {print ' '}} >> ", :RETURN => "=> %s\n" } So, what I want it do is like this: >> if "Jim" == "Fred" >> print "Ruby Sucks!" >> else >> print "Ruby is cool!" >> end >> print "And you know it!" 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.