[Ironruby-core] Running IronRuby script from C#

Timothy Barnes lists at ruby-forum.com
Tue Nov 2 14:07:05 EDT 2010


I am trying to get a Ruby file to run through C#.  I was reading through
"Ruby Unleashed" (book), and it appears to be easy.  However, I keep
getting an error on a very simple test. The text of my programs are:

C#:
using System;
using Microsoft.Scripting.Hosting;
using IronRuby;

class Run_Ruby
    {
        static void Main()
        {
            ScriptEngine engine = IronRuby.Ruby.CreateEngine();
            engine.ExecuteFile("C:/Test_Files/hello.rb");
        }
    }
-------------
hello.rb:
puts 'hello'

When I run the program I get:
"MissingMethodException was unhandled"
"undefined method `puts' for main:Object"

I am a novice to C#, but this should be hard.  What am I doing wrong?

Attachments:
http://www.ruby-forum.com/attachment/5280/C_toRuby.jpg


-- 
Posted via http://www.ruby-forum.com/.


More information about the Ironruby-core mailing list