Forum: IronRuby Using the generated initializer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-02-01 20:42
(Received via mailing list)
Hi

I thought I created a ruby module and ruby class but I must be doing
something wrong.

using RubyMethodAttributes=IronRuby.Runtime.RubyMethodAttributes;
using RubyModuleDefinition = IronRuby.Runtime.RubyModuleAttribute;
using RubyClassDefinition = IronRuby.Runtime.RubyClassAttribute;
using RubyMethodDefinition = IronRuby.Runtime.RubyMethodAttribute;

namespace IronRubyMvcLibrary.Controllers
{
    [RubyModuleDefinition("IronRubyMvc")]
    public static class IronRubyMvcModule
    {
        [RubyClassDefinition("Controller", Extends =
typeof(RubyController))]
        public class RubyControllerOps
        {
            [RubyMethodDefinition("info",
RubyMethodAttributes.PublicInstance)]
            public static void Info(RubyController self)
            {
                self.ViewData().Add("Platform", "IronRuby Mvc 1.0");
            }
        }

    }
}

I then used the classinitgenerator to create an initializer class.
But when I require the assembly after compiling I can't get to
IronRubyMvc
or the class.

Do I need to do something else?
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-02-01 21:55
(Received via mailing list)
Any reason why you don’t prefer to work with RubyController class
directly from Ruby code?

…

class RubyController
  def info
    view_data.add(“Platform”, “IronRuby Mvc 1.0”)
  end
end


Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Sunday, February 01, 2009 11:03 AM
To: ironruby-core@rubyforge.org
Subject: [Ironruby-core] Using the generated initializer

Hi

I thought I created a ruby module and ruby class but I must be doing
something wrong.

using RubyMethodAttributes=IronRuby.Runtime.RubyMethodAttributes;
using RubyModuleDefinition = IronRuby.Runtime.RubyModuleAttribute;
using RubyClassDefinition = IronRuby.Runtime.RubyClassAttribute;
using RubyMethodDefinition = IronRuby.Runtime.RubyMethodAttribute;

namespace IronRubyMvcLibrary.Controllers
{
    [RubyModuleDefinition("IronRubyMvc")]
    public static class IronRubyMvcModule
    {
        [RubyClassDefinition("Controller", Extends =
typeof(RubyController))]
        public class RubyControllerOps
        {
            [RubyMethodDefinition("info",
RubyMethodAttributes.PublicInstance)]
            public static void Info(RubyController self)
            {
                self.ViewData().Add("Platform", "IronRuby Mvc 1.0");
            }
        }

    }
}

I then used the classinitgenerator to create an initializer class.
But when I require the assembly after compiling I can't get to
IronRubyMvc or the class.

Do I need to do something else?
1e39a948a58f4569c53d971c2e120920?d=identicon&s=25 Ivan Porto carrero (casualjim)
on 2009-02-01 22:44
(Received via mailing list)
That is what I'm doing now


The other question was out of curiosity :)


On Sun, Feb 1, 2009 at 9:30 PM, Tomas Matousek
<Tomas.Matousek@microsoft.com
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-02-01 22:56
(Received via mailing list)
Good ☺.

BTW: Do you load the library using load_assembly <assembly-name>,
<namespace>?
E.g.
load_assembly 'IronRuby.Libraries', 'IronRuby.StandardLibrary.Sockets'

Just requiring the assembly loads it as regular .NET assembly w/o
invoking IronRuby library loader.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Ivan Porto
Carrero
Sent: Sunday, February 01, 2009 1:05 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Using the generated initializer

That is what I'm doing now


The other question was out of curiosity :)

On Sun, Feb 1, 2009 at 9:30 PM, Tomas Matousek
<Tomas.Matousek@microsoft.com<mailto:Tomas.Matousek@microsoft.com>>
wrote:

Any reason why you don't prefer to work with RubyController class
directly from Ruby code?



…



class RubyController

  def info

    view_data.add("Platform", "IronRuby Mvc 1.0")

  end

end





Tomas



From:
ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>
[mailto:ironruby-core-bounces@rubyforge.org<mailto:ironruby-core-bounces@rubyforge.org>]
On Behalf Of Ivan Porto Carrero
Sent: Sunday, February 01, 2009 11:03 AM
To: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org>
Subject: [Ironruby-core] Using the generated initializer



Hi

I thought I created a ruby module and ruby class but I must be doing
something wrong.

using RubyMethodAttributes=IronRuby.Runtime.RubyMethodAttributes;
using RubyModuleDefinition = IronRuby.Runtime.RubyModuleAttribute;
using RubyClassDefinition = IronRuby.Runtime.RubyClassAttribute;
using RubyMethodDefinition = IronRuby.Runtime.RubyMethodAttribute;

namespace IronRubyMvcLibrary.Controllers
{
    [RubyModuleDefinition("IronRubyMvc")]
    public static class IronRubyMvcModule
    {
        [RubyClassDefinition("Controller", Extends =
typeof(RubyController))]
        public class RubyControllerOps
        {
            [RubyMethodDefinition("info",
RubyMethodAttributes.PublicInstance)]
            public static void Info(RubyController self)
            {
                self.ViewData().Add("Platform", "IronRuby Mvc 1.0");
            }
        }

    }
}

I then used the classinitgenerator to create an initializer class.
But when I require the assembly after compiling I can't get to
IronRubyMvc or the class.

Do I need to do something else?

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
This topic is locked and can not be replied to.