How come when you redefine the inherited method in Class, you don't use
the 'class method' syntax? This doesn't work:
class Class
def Class.inherited(class_obj)
puts class_obj
puts
end
end
Instead, you have to write:
class Class
def inherited(class_obj)
puts class_obj
puts
end
end
Yet, in pickaxe2 on p. 445, the book lists inherited as a class method
of Class. And, if I have a class like this:
class Dog
def Dog.speak
puts 'Woof'
end
end
Dog.speak
-->Woof
and I want to redefine Dog.speak, I have to do this:
class Dog
def Dog.speak
puts 'yap yap'
end
end
Dog.speak
-->yap yap
--
Posted via http://www.ruby-forum.com/.