Thanks for that code, I was lurking reading this thread and have been
wondering all day how to implement that, because of you I will get a
good nights sleep.

pth


On Wed, 16 Mar 2005 05:34:47 +0900, Florian Gross <flgr / ccan.de> wrote:
> Niklas Frykholm wrote:
> 
> > Ah... interesting... but that technique doesn't really work with
> > String#index, since String#index doesn't take a block.
> >
> > I think I just have to resign from the idea of making a completely
> > transparent String wrapper.
> >
> > But it would be nice if this was resolved. In principle, I think it
> > should be possible to do the same things from Ruby as from C. I.e. if C
> > can set a variable $~ in the caller's scope, it should be possible to do
> > that from Ruby as well.
> 
> Indeed. See attachment, Binding.of_caller.
> 
> 
>