"yield" doesn't do in Ruby what it does in C#.
You'll probably need to define your own enumerator class doing something like
this:
class ProcedureEnumerator
include System::Collections::Generic::IEnumerator.of(Procedure)
def initialize *proc_list
@proc_list = proc_list
@pos = 0
end
def MoveNext
@pos = @pos + 1 if @pos < @proc_list.length
throw :IndexError if @pos < @proc_list.length
end
def Reset
@pos = 0
end
def Current
@[EMAIL PROTECTED]
end
end
def ListProcedure
ProcedureEnumerator.new(Procedure.new(...))
end
Alternatively, you could create a statically-typed list of Procedure and get an
enumerator from that:
list = System::Collections::Generic::List.of(Procedure)
list.add(Procedure.new(...))
Finally, we're shortly going to change the naming policy for overrides of CLS
virtual methods. When this happens, you'll need to define ProcedureEnumerator
with the "rubified" method names: move_next, reset and current.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Maurits Rijk
Sent: Thursday, October 30, 2008 7:45 AM
To: [email protected]
Subject: Re: [Ironruby-core] IronRuby for GIMP
Nice, the array conversion seems to work quite well. Right now I'm
encountering the next problem. The Plugin base class (C#) has the follow
signature:
protected abstract IEnumerator<Procedure> ListProcedures();
How can I implement this in my IronRuby derived class? Of course I tried
something like:
def ListProcedures
yield new Procedure(...)
end
However, this method never gets called.
Thanks,
Maurits
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core