J'ai une classe qui ressemble à ceci:Comment refactoriser ce simple extrait de Ruby?
class Base < Library
prelude "some-value" # from Library
def foo; ...; end
prelude "some-other-value" # from Library
def bar; ...; end
# ... others
end
Je voudrais factoriser en quelque chose comme ce qui suit:
class Base < Library
# what goes here to bring FooSupport and BarSupport in?
end
class FooSupport (< ... inherit from something?)
prelude "..." # Need a way to get Library prelude.
def foo; ...; end
end
class BarSupport (< ... inherit from something?)
prelude "..." # Need a way to get Library prelude.
def bar; ...; end
end
Comment puis-je faire cela?
Cela a fonctionné! Merci beaucoup. –