[Ironruby-core] How to Refer to the Classes in my Custom DLL

Jimmy Schementi Jimmy.Schementi at microsoft.com
Mon Jul 6 12:32:09 EDT 2009


"include" only works for .NET namespaces, as they map to Ruby modules, not Ruby classes. You can't "include" a Ruby class.

Does this class library have a namespace? If so, you can either use the fullname or include the namespace.

require 'BusinessObjects'

NameOfNamespace::BusinessObjects # => NameOfNamespace::BusinessObjects
# or
include NameOfNamespace
BusinessObjects # => BusinessObjects

> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
> bounces at rubyforge.org] On Behalf Of Mohammad Azam
> Sent: Monday, July 06, 2009 9:28 AM
> To: ironruby-core at rubyforge.org
> Subject: [Ironruby-core] How to Refer to the Classes in my Custom DLL
>
> Hi,
>
> I have a class library in C# called "BusinessObjects" and I want to refer to that
> DLL using IronRuby.
>
> I typed:
>
> require 'BusinessObjects'
> true
>
> include BusinessObjects
>
>
> >>> include BusinessObjects
> C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICT
> ED\Builtin
> s\ModuleOps.cs:793:in `const_missing': uninitialized constant
> Object::BusinessOb jects (NameError)
>         from :0
>
> I want to refer to a Customer class inside the BusinessObjects library.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list