[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Pasting code with tab indentation to irb

benny

5/26/2005 11:47:00 AM

dear list,

I want to be able to copy/paste code with tab indentation to irb, but I
don't know how to setup irb for this.

I am aware of

require 'irb/completion'

in the .irbrc taking the tab completition away from the shell and
making its own tab completition.

So maybe I may overwrite some method in irb/ irb/completition to prevent
irb tab completition and shell/bash tab completition.

I tried to figure it out on my own but didn't succeed.

Any hints? (Please no discussion about tab indentation vs. space indentation
here :) )


benny
1 Answer

Mark Hubbart

5/26/2005 5:46:00 PM

0

On 5/26/05, benny <listen@marcrenearns.de> wrote:
> dear list,
>
> I want to be able to copy/paste code with tab indentation to irb, but I
> don't know how to setup irb for this.
>
> I am aware of
>
> require 'irb/completion'
>
> in the .irbrc taking the tab completition away from the shell and
> making its own tab completition.
>
> So maybe I may overwrite some method in irb/ irb/completition to prevent
> irb tab completition and shell/bash tab completition.
>
> I tried to figure it out on my own but didn't succeed.
>
> Any hints? (Please no discussion about tab indentation vs. space indentation
> here :) )

You could assign a new input method to IRB.CurrentContext.io:
IRB.CurrentContext.io = IRB::StdioInputMethod.new

Write a short-named method that toggles the input method between
IRB::StdioInputMethod and IRB::ReadlineInputMethod, and you can
quickly switch between the two modes.

cheers,
Mark