From: Smart RoR on
Hello:

Where in Ruby is the less than sign for inheritance in classes defined?

class A < B


The < here that is.


Thanks.
--
Posted via http://www.ruby-forum.com/.

From: Gary Wright on

On Mar 22, 2010, at 10:07 PM, Smart RoR wrote:
> Where in Ruby is the less than sign for inheritance in classes defined?
>
> class A < B

I'm not sure if I understand your question, but '<' is just syntax when
used in a class definition. In this context, it is not an operator and so
there is no method associated with its use in this context.

Gary Wright


From: Smart RoR on
Gary Wright wrote:
> On Mar 22, 2010, at 10:07 PM, Smart RoR wrote:
>> Where in Ruby is the less than sign for inheritance in classes defined?
>>
>> class A < B
>
> I'm not sure if I understand your question, but '<' is just syntax when
> used in a class definition. In this context, it is not an operator and
> so
> there is no method associated with its use in this context.
>
> Gary Wright

Every operator is a method in ruby....

like 1 - 1 = 0 here - is a method.

That is my understanding....

--
Posted via http://www.ruby-forum.com/.

From: Albert Schlef on
Smart RoR wrote:
> Every operator is a method in ruby....
>
> like 1 - 1 = 0 here - is a method.
>
> That is my understanding....

And is the "=" too a method? Can you redefine it?

> Where in Ruby is the less than sign for inheritance
> in classes defined?

If you want to find out if somebody is inheriting your class, implement
'MyClass.inherited' (it's a hook).
--
Posted via http://www.ruby-forum.com/.

From: Gary Wright on

On Mar 23, 2010, at 12:05 AM, Smart RoR wrote:
> Every operator is a method in ruby....
>
> like 1 - 1 = 0 here - is a method.
>
> That is my understanding....

Let me try again. The '<' in a class definition
is not an operator and so doesn't have an
associated method. It looks like an operator
but is not parsed or interpreted as an operator
when used in a class definition.

Gary Wright