Pit Capitain
8/21/2008 10:56:00 AM
2008/8/20 Sam Hendley <sam.hendley@plymouthsystems.com>:
> Hello, this is my first post to this list and I have only been using
> ruby for a couple of weeks so forgive me if its overly simple, I spent a
> few hours searching and wasn't able to figure this out myself.
Welcome Sam. Before answering, let me ask you two more questions :-)
1) Why are you asking the instances about the extra methods? Instead of
Foo.new.extra_methods
I would expect
Foo.extra_methods
Or do you want to define extra methods for individual objects, too?
2) How deep will your class hierarchy be? What about subclasses of
Foo, for example, after
class SubFoo < Foo
add_method :foo_4
end
what should be the result of
SubFoo.new.extra_methods.size
BTW: the normal indentation of Ruby code is with two spaces per level.
Regards,
Pit