Clr events in ruby

Hi everyone,

I’m messing around with trying to create ironruby mock (actually
recorder)
implementations of various sorts of CLR type features and am struggling
with
events.

Is it currently possible to create an implementation of a CLR interface
that
contains an event?

For example

using System;

namespace ClassLibrary
{
public interface IHaveAnEvent
{
event EventHandler MyEvent;
}
}

class ClassWithEvent
include ClassLibrary::IHaveAnEvent

def initialize
@blocks = []
end

def add_MyEvent
??? or something ???
end
end

Is this possible or not yet available?

I believe that this should work, but the name would need to be Rubified
as “add_my_event”.

From: [email protected]
[mailto:[email protected]] On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:02 AM
To: [email protected]
Subject: [Ironruby-core] clr events in ruby

Hi everyone,

I’m messing around with trying to create ironruby mock (actually
recorder) implementations of various sorts of CLR type features and am
struggling with events.

Is it currently possible to create an implementation of a CLR interface
that contains an event?

For example
using System;

namespace ClassLibrary
{
public interface IHaveAnEvent
{
event EventHandler MyEvent;
}
}


class ClassWithEvent
include ClassLibrary::IHaveAnEvent

def initialize
@blocks = []
end

def add_MyEvent
??? or something ???
end
end

Is this possible or not yet available?

No dice i’m afraid:
with ‘add_my_event’:

Snippets.scripting:0:in add_MyEvent': undefined methodadd_MyEvent’
for
IronRuby.Classes.Object$5:ClassWithEvent (NoMethodError)
from ClassLibrary:0:in `RegisterEvent’
from experiment1.rb:90

with ‘add_MyEvent’:

Snippets.scripting:0:in add_MyEvent': The method or operation is not implemented. (System::NotImplementedException) from ClassLibrary:0:inRegisterEvent’
from experiment1.rb:90

Sorry… I just looked at the source code and events are indeed not
implemented yet. I promised Tomas I’d try really really hard to finish
the typegen code this month, so you shouldn’t have to wait too long.

From: [email protected]
[mailto:[email protected]] On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:46 AM
To: [email protected]
Subject: Re: [Ironruby-core] clr events in ruby

No dice i’m afraid:

with ‘add_my_event’:

Snippets.scripting:0:in add_MyEvent': undefined method add_MyEvent’
for IronRuby.Classes.Object$5:ClassWithEvent (NoMethodError)
from ClassLibrary:0:in `RegisterEvent’
from experiment1.rb:90

with ‘add_MyEvent’:

Snippets.scripting:0:in add_MyEvent': The method or operation is not implemented. (System::NotImplementedException) from ClassLibrary:0:in RegisterEvent’
from experiment1.rb:90

On Mon, May 4, 2009 at 11:25 PM, Curt H.
<[email protected]mailto:[email protected]> wrote:

I believe that this should work, but the name would need to be Rubified
as “add_my_event”.

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:02 AM
To: [email protected]mailto:[email protected]
Subject: [Ironruby-core] clr events in ruby

Hi everyone,

I’m messing around with trying to create ironruby mock (actually
recorder) implementations of various sorts of CLR type features and am
struggling with events.

Is it currently possible to create an implementation of a CLR interface
that contains an event?

For example

using System;

namespace ClassLibrary

{

 public interface IHaveAnEvent

 {

      event EventHandler MyEvent;

 }

}

class ClassWithEvent

include ClassLibrary::IHaveAnEvent

def initialize

@blocks = []

end

def add_MyEvent

???? or something ????

end

end

Is this possible or not yet available?