I tried to implement similar solution some time ago, in case with Foo -
it may looks like that:
class Foo
instance_methods do
def foo
end
end
end
Foo.instance_methods do
def bar
end
end
For working code and specs please go to:
specs:
http://github.com/alexeypetrushin/ruby-ext/blob/master/lib/ruby_ext/prototype_inheritance.rb
code:
http://github.com/alexeypetrushin/ruby-ext/blob/master/spec/ruby_ext/_prototype_inheritance_spec.rb
It seems to works, but I prefer (and using actually) a little lighter
solution, kind of mixins with sugar, you can find more details about it
here http://bos-tec.com/pages/ruby-multiple-inheritance
--
Posted via http://www.ruby-forum.com/.