Hi,

Am Donnerstag, 24. Feb 2005, 11:58:09 +0900 schrieb Sam Roberts:
> Quoting jim / weirichhouse.org, on Thu, Feb 24, 2005 at 02:38:35AM +0900:
> > You could do ...
> > 
> >   class A
> >     def do_something() ... end
> >   end
> >   class B
> >     def do_something() ... end
> >   end
> > 
> >   t.do_something

Of course.

> I know where you are coming from, this is a nice pattern, but in this
> case t is a return value of Resolv::DNS::Message#question, and I have to
> answer the question. How I answer the question depends on the question
> (of course!), but is not part of the behaviour of the question,
> different "answers" answer the question in different ways.

I accept that. So I try:

  $ ruby -e 'class Class ; def === oth ; self == oth ; end ; end ;
  > class C ; end ; p C === C'
  true

But this one crashes:

  $ irb
  irb(main):001:0> class Class ; def === oth ; self == oth ; end ; end
  => nil
  irb(main):002:0> class C ; end
  /usr/local/lib/ruby/1.9/irb/ruby-token.rb:101:in `Token': undefined method `ancestors' for ";":String (NoMethodError)
  ...

Is this the behaviour to be expected?

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de