Clr events in ruby


#1

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?


#2

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

From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:02 AM
To: removed_email_address@domain.invalid
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?


#3

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


#4

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: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:46 AM
To: removed_email_address@domain.invalid
Subject: Re: [Ironruby-core] clr events in ruby

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

On Mon, May 4, 2009 at 11:25 PM, Curt H.
<removed_email_address@domain.invalidmailto:removed_email_address@domain.invalid> wrote:

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

From:
removed_email_address@domain.invalidmailto:removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalidmailto:removed_email_address@domain.invalid]
On Behalf Of Mark R.
Sent: Monday, May 04, 2009 6:02 AM
To: removed_email_address@domain.invalidmailto:removed_email_address@domain.invalid
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?