Hello --

On Fri, 21 Sep 2001, Kevin Smith wrote:

> --- "Frykholm, Niklas" <nfrykholm / rsasecurity.com> wrote:
> > 	self.class.new(self.gsub /\d/,'')
> (snip)
> > Your class, HoX should be as polite, that is why
> > delete_digits should use self.class.new rather than
> > HoX.new, it makes it possible for someone to create a
> > subclass of HoX and chain the method calls.
>
> Nice bit about new--I hadn't thought of that. But wouldn't
> this be the same (and slightly simpler)?
>
>   self.class.new(gsub /\d/,'')
>
> Or perhaps (I don't have Ruby in front of me) this:
>
>   class.new(gsub /\d/,'')

The bare "class" usually doesn't parse because Ruby thinks it's
going to be a class definition.  You can always use the synonym
"type", or just include the "self".


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav