Joel VanderWerf
3/11/2007 8:24:00 AM
Garance A Drosehn wrote:
> On 3/2/07, Ara.T.Howard <ara.t.howard@noaa.gov> wrote:
>>
>>
>> i looked forever, didn't find this, and am posting for posterity
>>
>> harp:~ > cat .irbrc
>> IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE] ][:RETURN]=''
>>
>> harp :~ > irb
>> irb(main):001:0> 42
>> irb(main):002:0> 43
>> irb(main):003:0> puts 42
>> 42
>> irb(main):004:0> p 42
>> 42
>> irb(main):005:0> p 'no echo'
>> "no echo"
>> irb(main):006:0> 'no echo'
>
>
>
> Hmm, that's pretty neat. It seems like it only works in .irbrc. It'd be
> nice
> if one could turn that off in the middle of a session in irb. Still, it's
> nice
> to know it can be turned off at all! Thanks.
You can turn it on and off by destructively modifying the string, this way:
irb(main):027:0> IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE] ][:RETURN]
=> "=> %s\n"
irb(main):028:0> IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE]
][:RETURN].replace('')
irb(main):029:0> 1+2
irb(main):030:0> IRB.conf[:PROMPT][ IRB.conf[:PROMPT_MODE]
][:RETURN].replace("=> %s\n")
=> "=> %s\n"
irb(main):031:0> 1+2
=> 3
It should be pretty easy to define a function in your .irbrc that wraps
this up nicely....
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407