0
我有一個類,看起來像這樣:我該如何重構這個簡單的Ruby代碼片段?
class Base < Library
prelude "some-value" # from Library
def foo; ...; end
prelude "some-other-value" # from Library
def bar; ...; end
# ... others
end
我想將它重構爲類似如下:
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
我怎樣才能做到這一點?
這工作!非常感謝你。 – 2010-08-14 14:57:04