Hi --

On Thu, 5 Oct 2006, dblack / wobblini.net wrote:

>  class Foo
>    def initialize
>      tmp1, tmp2 = EO.new, EO.new
>      define_method("c1") { do stuff with tmp1 etc. }
>      tmp1, tmp2 = EO.new, EO.new
>      define_method("c2") { do stuff with tmp1 etc. }
>    end
>  end
>
> or something like that.  I'd be inclined to revisit the instance
> variable version, though.  I'm at the bottom of the well of mental
> energy right now or I'd try to come up with a twist on it that might
> seem less coupled....

See Joel's response for how to do this correctly :-)  (i.e., calling
define_method in top-level class definition scope, not in an instance
method where it won't have any meaning)


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org