On Aug 21, 2006, at 7:42 PM, ara.t.howard / noaa.gov wrote: > > food for thought: > > harp:~ > cat a.rb > def context_load path, &context > o = Object.new > o.instance_eval &context > o.instance_eval IO.read(path) > end > > context_load 'b.rb' do > def m() p 'foo' end > end > > context_load 'b.rb' do > def m() p 'bar' end > end > harp:~ > cat b.rb > m() > > > harp:~ > ruby a.rb > "foo" > "bar" Yeah, if I decide to go this route (rather than just taking the easy, already-working route of requiring a receiver for the method), it definitely makes sense to pull it into a separate method. > related > > http://codeforpeople.com/lib/ruby/dynaload/ I'll look into that more closely. I've already used some of the ideas in it, but I can't seem to understand the general idea behind it. What problems are you solving with this? Most of my dynamic loading is based on the assumption that I'm loading someone else's code, so I want to do as much as possible for the user. I don't want them to have to know how I'm automatically loading their files, for instance. I think for now, I'm just going to leave it as is; people can specify the appropriate module as the receiver. -- Luke Kanies http://madstop.com | http://reductivelabs.com | 615-594-8199