[Nitro] Og Revisted

TRANS transfire at gmail.com
Sun Feb 12 12:08:49 EST 2006

> def require_og_models(*models)
>  snapshot_pre = []
>  snapshot_post = []
>  ObjectSpace.each_object{|o| snapshot_pre << o}
>  models.each{|m| require(m)}
>  ObjectSpace.each_object{|o| snapshot_post << o}
>  enchant(snapshot_post-snapshot_pre)
> end
> require_og_models "model.rb"

While interesting, it doesn't really cover all that is required.
Enchanting a class is inherintly "mixin". It is not just something
that happens to a class post definition. Enchanting adds methods
availalbe in the design of the class, such as the relation methonds,
the aspect methods.

(Also looping through all of object space, twice, is pretty time consuming.)


More information about the Nitro-general mailing list