From: ara.t.howard@... Date: 2006-05-16T01:19:28+09:00 Subject: Re: Weird class-loading issue (or maybe a problem with define_method?) On Tue, 16 May 2006, Pat Maddox wrote: > I'm not sure how that fixes anything. Foo has to create some Bar > objects, and Bar has to have access to some of the Foo constants. I > didn't talk about that in my initial post, but each class interacts > with each other. > > Pat a setup like this will give you that harp:~ > cat foo_constants.rb module FooConstants FOO = 42 end harp:~ > cat foo.rb require 'foo_constants' class Foo include FooConstants end harp:~ > cat bar.rb require 'foo_constants' class Bar include FooConstants def self.set_foo(val) define_method(:foo) { val } end end harp:~ > ruby foobar.rb 42 hard to understand __why__ you'd do that - but factoring module-wise will certainly lead to an elegant answer. regards. -a -- be kind whenever possible... it is always possible. - h.h. the 14th dali lama