From: Smart RoR on 22 Mar 2010 22:07 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 22 Mar 2010 23:56 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 23 Mar 2010 00:05 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 23 Mar 2010 00:13 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 23 Mar 2010 01:15
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 |