[Backgroundrb-devel] Worker suicide

Charles Brian Quinn me at seebq.com
Wed Sep 6 09:15:24 EDT 2006


the :: means, start the class/module lookup at the root, so as not to
conflict with any class/module namespaces you might already have.

If you have a class you've defined called, say Violin, and it has a
module or maybe a subclass called String (since violins have strings,
get it?), then, if you wanted to create an actual String to deal with
letters, you'd have to create it like so:

::String.new("A")

because just saying:

String.new("A")

would find your Violin::String before it found the real String class.

it's like in xpath, putting the // will return you to the root of the
doc to perform lookups.

If you're interested, the Ruby for Rails book has more on this (and
uses the same example that I blantantly stole).

On 9/6/06, Jonathan Métillon <jmetillon at gmail.com> wrote:
> Thanks Ezra that works very well!
>
> Can you tell me what means the :: at the start of the line?
>
>
> On 9/1/06, Ezra Zygmuntowicz < ezmobius at gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> > On Sep 1, 2006, at 8:00 AM, Jonathan Métillon wrote:
> >
> >
> >
> > Hi the list people, hi Ezra,
> >
> > I just read from this message
> http://rubyforge.org/pipermail/backgroundrb-devel/2006-July/000134.html
> that BackgrounDRb will offer a way to kill a worker from within itself.
> >
> > As this message is from 7/25, I wonder if this feature has been added
> since. If not, is there any way to do it? I tried this:
> >
> > MiddleMan.delete_worker (@_job_key)
> >
> > But it raise:
> >
> > uninitialized constant MiddleMan - (NameError)
> >
> > Thanks
> >
> > Jonathan
> >
> >
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > Backgroundrb-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> >
> > Jonathan-
> >
> >
> > If your worker is done and not doing any more computation you can just
> call kill from within your worker. If it is still working on something and
> you need its thread to be killed also you can do like this:
> >
> >
> > ::BackgrounDRb::MiddleMan.instance.delete_worker
> @_job_key
> >
> >
> > -Ezra
>
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
>


-- 
Charles Brian Quinn
self-promotion: www.seebq.com
highgroove studios: www.highgroove.com
slingshot hosting: www.slingshothosting.com


More information about the Backgroundrb-devel mailing list