[Ironruby-core] problem

Nathan Stott nrstott at gmail.com
Wed Mar 18 11:33:00 EDT 2009


Hi all.  I have a question that probably belongs on a users mailing list but
I could not find one.
I get the following error when trying to use my IronRuby windsor
registration script:
System.InvalidOperationException: can't convert
Castle::Core::ComponentModel into Castle::Core::ComponentModel

I assume this has something to do with the fact that newing up an object in
IronRuby isn't the same thing as newing it up in C#.

Any suggestions or guidance would be appreciated.

Here is the important IronRuby code:

require 'Castle.Windsor'
require 'Castle.MicroKernel'
require 'Castle.Core'

ComponentRegistration =
Castle::MicroKernel::Registration::ComponentRegistration
ComponentModel = Castle::Core::ComponentModel
Parameter = Castle::MicroKernel::Registration::Parameter
Component = Castle::MicroKernel::Registration::Component

def component(options)
throw :classIsRequired if !options.has_key?(:class)
 klass = options[:class].to_clr_type
 if options.has_key?(:service)
service = options[:service].to_clr_type
else
service = klass
end
 if options.has_key?(:name)
name = options[:name]
else
name = klass.class.name.underscore.lowercase
end
 model = ComponentModel.new(name, service, klass)
 if options.has_key?(:parameters)
parameters = options[:parameters]
parameters.each do |p|
model.Parameters.Add(p.key, p.value)
end
end
 $container.Register(ComponentRegistration.new(model))
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090318/cd1084f7/attachment.html>


More information about the Ironruby-core mailing list