Here’s a test case illustrates the problem. Then we’ll have a candidate
and some questions.
@@frog_list << species
@@frog_list = 
class Toad < Kozmik
class BullFrog < Kozmik
assert_equal [:tree, :riparian], BullFrog.frog_list
assert_equal [:bufo, :kermit], Toad.frog_list
Suppose we need an ‘acts_as_’ system to generate some methods for our
classes. And suppose one method is a list of all the arguments passed to
each acts_as_() in each specific class.
The above test fails because @@ occupies the entire inheritance chain.
both frog_list() class-methods return [:tree, :riparian, :bufo,
The fix seems to be to reach into the meta-class for each derived class:
@frog_list ||= 
@frog_list << species
self.class.send :attr_accessor, :frog_list
Is that as clean and lean as it could be? Is there some way to do this
even fewer lines?
Next question: Couldn’t class Kozmik be a module instead?