On 02/10/05, David A. Black <dblack / wobblini.net> wrote:
> Hi --
>
> On Mon, 3 Oct 2005, [ISO-8859-1] Brian Schröäer wrote:
>
> > [snip question]
>
> I doubt this is the final word in it but see if this helps:
>
>    class A
>      def self.def_me(cmd, &block)
>        define_method(cmd) do
>          puts "Defining method"
>          block.call(self)
>        end
>      end
>
>      def_me("foo") do |a|
>        puts "Here in block"
>        puts "self is #{self}, a is #{a}"
>      end
>    end
>
>    A.new.foo
>
>
> David
>
> --
> David A. Black
> dblack / wobblini.net
>
>

Thank you david, I always forget about things like define_method.
Passing self back into the block was one solution I had thought about,
but it is not exactly pretty.

best regards,

Brian


--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/