[Ironruby-core] Busy Day with IronRuby

Ivan Porto Carrero ivan at flanders.co.nz
Sun Jan 27 18:38:20 EST 2008


Hi Michael

I think we can work together for that, seen as I will have a bunch of
samples I'm writing for the book

I haven't gotten round to putting a website/blog up because most of the
CMS/blog systems out there don't do exactly what I want (which is not much).
I want it to be ruby of course.

Email me off list if you like the idea?

Cheers
Ivan

On Jan 28, 2008 12:34 PM, Michael Letterle <michael.letterle at gmail.com>
wrote:

> I'm actually getting ready to work on an IronRuby quick start blog
> post, based on my experiences, but this is the simplest "hello world"
> using the hosting mechanism I could come up with:
>
> using System;
> using Ruby.Runtime;
> using Microsoft.Scripting.Hosting;
> namespace RubyExample
> {
>    static class Program
>    {
>        /// <summary>
>        /// The main entry point for the application.
>        /// </summary>
>        [STAThread]
>        static void Main()
>        {
>            IScriptEnvironment scriptenvironment =
> ScriptEnvironment.GetEnvironment();
>            IScriptEngine rubyengine = scriptenvironment.GetEngine("ruby");
>            scriptenvironment.ExecuteSourceUnit(
> rubyengine.CreateScriptSourceFromString("puts
> 'Hello World!\nPress Any Key To Continue..'") );
>            Console.ReadKey();
>
>        }
>    }
> }
>
> be sure to add references to Microsof.Scripting.dll and IronRuby.dll
> (and IronRuby.Libraries.dll if you're so inclined).
>
> You can also use scriptenvironment.ExecuteFile(pathtofile) if you have
> your ruby script inn a standalone file.
>
> On Jan 27, 2008 6:16 PM, Greg Akins <angrygreg at gmail.com> wrote:
> > OK, so I couldn't get some of the simple examples of using RubyEngine
> > to start calling Ruby from C#...
> >
> > So I spent a bit reading through the mailing list archives (realizing
> > while doing that, that I'd asked a frequently asked question).
> >
> > Now, I hope I'm not asking another stupid question.
> >
> > I found another post (
> > http://rubyforge.org/pipermail/ironruby-core/2008-January/000616.html
> > ) that suggests a method of running Ruby.
> >
> > However, I get an error on this line
> >
> >             IScriptEngine engine = IronRuby.GetEngine(runtime);
> >
> > Which shows this stack trace
> >
> >    at System.RuntimeMethodHandle._InvokeConstructor(Object[] args,
> > SignatureStruct& signature, IntPtr declaringType)
> >    at System.RuntimeMethodHandle.InvokeConstructor(Object[] args,
> > SignatureStruct signature, RuntimeTypeHandle declaringType)
> >    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
> > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
> >    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
> > Binder binder, Object[] args, CultureInfo culture, Object[]
> > activationAttributes)
> >    at System.Activator.CreateInstance(Type type, BindingFlags
> > bindingAttr, Binder binder, Object[] args, CultureInfo culture,
> > Object[] activationAttributes)
> >    at System.Activator.CreateInstance(Type type, Object[] args)
> >    at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type
> > actualType, Object[] args) in
> >
> c:\Libraries\IronRuby\trunk\src\microsoft.scripting\Utils\ReflectionUtils.cs:line
> > 127
> >
> > --
> > Greg Akins
> > Software Development Manager
> > SSI Services
> >
> > http://kc.vanadium.com
> > http://www.pghcodingdojo.org
> > http://www.insomnia-consulting.org/monologue
> > _______________________________________________
> > Ironruby-core mailing list
> > Ironruby-core at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/ironruby-core
> >
>
>
>
> --
> Michael Letterle
> [Polymath Programmer]
> http://michaeldotnet.blogspot.com
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080128/3e7b8fdc/attachment.html 


More information about the Ironruby-core mailing list