From: Devin Mullins Date: 2005-07-16T09:15:21+09:00 Subject: Re: Customizable Mixin Or, for that Railsy flair: module Foo end class Object def extend_foo(name) extend Foo @foo_name = name end end class Bar def initialize(name) extend_foo name end end Devin Devin Mullins wrote: > Phrogz wrote: > >> It would be effective to simply say "Hey, if you include this module in >> your class, you need to supply @foo or else it'll break". But for some >> reason that seems wrong to me. >> >> > Why? Enumerable requires you to supply #each. > > Another possibility: > > module Foo > def foo_name=(foo_name) > @foo_name = foo_name > end > end > > class Bar > include Foo > def initialize(name) > self.foo_name = name > end > end > > Your way seems like a lot of (confusing, to me) overhead which not > much benefit, pragmatic or idealogical. But I could be missing something. > > Devin > > >