Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

You are here: Home / .NET / RubyCLR – Ruby meets .NET

RubyCLR – Ruby meets .NET

March 30, 2006 by Rob Bazinet

Tweet

My day job dictates most of my work be in .NET using C#, for the most part it works well. The usual drawbacks you hear are the costs of implementing a Microsoft solution using Windows 2003 and SQL Server. The platforms are complex but they do work. In my spare time I have had an interest in learning a new language, which is Ruby. Ruby is a language written by a Japenese developer and has gotten very popular as of late. If you haven’t gotten the chance to look at Ruby it was developed with other languages in mind and trying to better them, SmallTalk and Perl are a couple of those languages. It is well worth a look. Well it seems a developer named John Lam has created a Ruby to CLR bridge, known as RubyCLR, so developers can create Ruby code under the .NET CLR. It sounds like a match made in heaven and it has been getting more attention as of late. I downloaded the latest RubyCLR drop from John’s web site and proceeded to install it. Install is a strong word since you simple unzip the contents of the file into a directory. All of the CLR bridge source code is included as well as a bunch of ruby code to handle the Ruby side of things and a bunch of Ruby files that exercises the bridge to the CLR. The code below is an example from the drop. It brings up a window running in Windows and databinds a drop down list. It’s just works.

require 'winforms'
class MainForm def initialize form = Form.new form.Text = 'Ruby WinForms App' names = [] names << 'John' << 'Paul' << 'George' << 'Ringo' list = ListBox.new list.data_source = names.make_bindable form.controls.add(list) @form = form end end WinFormsApp.run(MainForm)

I have installed and tested all of the samples that came with RubyCLR, all but one work and it may be a permission issue on my system I need to work out. John points out his samples were tested in Ruby 1.8.2, but I am running 1.8.4 so it may have something to do with the differing version numbers too. I plan to write my own .NET apps over the coming weeks using this tool. I report my progress and share the code I create. Update : 7/30/2007 – the RubyCLR project has moved to RubyForge.? The project can be found at http://rubyforge.org/projects/rubyclr/. Technorati Tags : Ruby, Ruby on Rails, RubyCLR

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Related

Filed Under: .NET

Care about your privacy? I do and use Fathom Analytics on this site.

Fathom Analytics

Comments

  1. John Lam says

    March 30, 2006 at 4:55 pm

    Rob – can you let me know which sample isn’t working? I have other folks who have run things successfully on 1.8.4, but I still haven’t upgraded yet …

  2. John Lam says

    March 30, 2006 at 4:55 pm

    Rob – can you let me know which sample isn’t working? I have other folks who have run things successfully on 1.8.4, but I still haven’t upgraded yet …

  3. Rob Bazinet says

    April 3, 2006 at 8:23 am

    John,

    The sample that is not working is the RssReader. I get the following error:

    “C:/Dev/RubyCLR/Src/Ruby/core.rb:244:in `const_missing’: uninitialized constant S

    ystem::Net (NameError)

    from C:/Dev/RubyCLR/Samples/RssReader/rssreader.rb:6″

    All of the other samples work fine.

  4. Rob Bazinet says

    April 3, 2006 at 8:23 am

    John,
    The sample that is not working is the RssReader. I get the following error:
    “C:/Dev/RubyCLR/Src/Ruby/core.rb:244:in `const_missing’: uninitialized constant S
    ystem::Net (NameError)
    from C:/Dev/RubyCLR/Samples/RssReader/rssreader.rb:6”
    All of the other samples work fine.

  5. Pedro Moreira says

    April 12, 2006 at 7:03 am

    Hi Rob,

    I am more of a .Net guy than a Ruby, but i’m curious about ruby and mainly how to integrate with .Net.

    While trying the samples, I had the same problem and managed to fix it by doind the following:

    1. Added RubyClr::reference ‘System’ to rssreader.rb

    This should add a reference to System.dll assembly where System.Net namespace can be found.

    2. Mapped paths in offline_links.dat to correct location of rubyclr.

    Hope this is of any help to you…

  6. Pedro Moreira says

    April 12, 2006 at 7:03 am

    Hi Rob,
    I am more of a .Net guy than a Ruby, but i’m curious about ruby and mainly how to integrate with .Net.
    While trying the samples, I had the same problem and managed to fix it by doind the following:
    1. Added RubyClr::reference ‘System’ to rssreader.rb
    This should add a reference to System.dll assembly where System.Net namespace can be found.
    2. Mapped paths in offline_links.dat to correct location of rubyclr.
    Hope this is of any help to you…

  7. Rob Bazinet says

    April 12, 2006 at 11:54 am

    Pedro,

    I am more of a .NET guy too. My curiosities are the same as yours.

    I did try what you suggested a few days ago and I get a different error.

    Are you using Ruby 1.8.4? I assume your are on .NET 2.0 Framework. I don’t even know if RubyCLR runs on 1.x.

  8. Rob Bazinet says

    April 12, 2006 at 11:54 am

    Pedro,
    I am more of a .NET guy too. My curiosities are the same as yours.
    I did try what you suggested a few days ago and I get a different error.
    Are you using Ruby 1.8.4? I assume your are on .NET 2.0 Framework. I don’t even know if RubyCLR runs on 1.x.

  9. Vijay Kanetkar says

    September 8, 2006 at 7:39 am

    Hi,

    I am also running Ruby 1.8.4 Windows 2K, .NET Framework 2.0.

    I could build project successfully using Visual Studio 2005.

    My question:

    How did you run the above sample program? Did you have to compile the program (with what?)

    Could you guide me thru running above program?

  10. Vijay Kanetkar says

    September 8, 2006 at 7:39 am

    Hi,
    I am also running Ruby 1.8.4 Windows 2K, .NET Framework 2.0.
    I could build project successfully using Visual Studio 2005.
    My question:
    How did you run the above sample program? Did you have to compile the program (with what?)
    Could you guide me thru running above program?

  11. Jeremy D. Miller -- The Shade Tree Developer : Using Anonymous Methods with Control.Invoke() says

    November 5, 2006 at 10:49 pm

    […] WinForms with a cleaner syntax. Share this post: Email it! | bookmark it! | digg it! | reddit!| kick it! _uacct = “UA-531207-1”; urchinTracker(); Published Sunday, November 05, 2006 8:49 PM byjmiller […]

  12. Jeremy D. Miller -- The Shade says

    November 5, 2006 at 10:49 pm

    […] WinForms with a cleaner syntax. Share this post: Email it! | bookmark it! | digg it! | reddit!| kick it! _uacct = “UA-531207-1”; urchinTracker(); Published Sunday, November 05, 2006 8:49 PM byjmiller […]

  13. Ra?f says

    July 29, 2007 at 9:22 pm

    I cannot find the latest IronRuby download anywhere. Any hints? Link?

  14. Ra?f says

    July 29, 2007 at 9:22 pm

    I cannot find the latest IronRuby download anywhere. Any hints? Link?

  15. Rob Bazinet says

    July 29, 2007 at 9:27 pm

    It was moved to RubyForge, find it here rubyforge.org/…/rubyclr

    -Rob

  16. Rob Bazinet says

    July 29, 2007 at 9:27 pm

    It was moved to RubyForge, find it here rubyforge.org/…/rubyclr
    -Rob

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet (ruby.social/@rbazinet)
@rbazinet

  • Working to wrap up my current consulting gig by mid-April. I will be looking for the next thing soon. If anyone has… https://t.co/sg3cSV9yqM
    about 1 hour ago
  • I’ve been spending some time using Notion AI lately and it surprisingly good. Since all the rage lately is ChatGPT,… https://t.co/cUXFWIRCVV
    about 2 days ago
  • I think these steps are true for any target audience. https://t.co/0ht6rIzOW3
    about 3 days ago
  • I’ve been enjoying a show from the Magnolia network called The Craftsman. It’s mainly about woodworking but his phi… https://t.co/sWTUBbSsl6
    about 3 days ago
  • I found the resource I was looking for last night that is similar to https://t.co/Pyn0IIjRdP, it is… https://t.co/U7TMe77FMF
    about 3 days ago
  • RSS - Posts
  • RSS - Comments
Find me on Mastodon