On Jan 8, 2008 10:06 PM, Sur [email protected] wrote:
No, I was not actually saying that… In the class I meant this…
p “I am author”
and if I call Person.new.man.author, it gives NoMethodError.
you assume that it’s a hierarchy, but it’s not.
NoMethodError: undefined method `author’ for nil:NilClass
“I am author”
the chain seems to work on plain defs since by default if you do not
specify a class, ruby creates it in Object class. Thus the methods
defined are Object methods, ergo they become “public” so to speak.
Thus even nil class acquired the reader/author method; thus exhibiting
the seemingly hierachical behaviour (see my prev post). There is no
function as function per se in ruby. There are only methods wc of
course belong to a class.
kind regards -botp