ironruby

What are the benefits of using IronPython over IronRuby or F#?

Well aware that DLR is here!! I have recently reading up on all of these and was wondering if there were any specific benefits of using one language over another? For example performance benefits! and available functionality through standard libaries!! ...

C# instead of IronRuby as an embedded "scripting" language in .NET 3.5

What is the best practice for using C# as an embedded internal scripting application for a .NET 3.5 application? I have an app with a few small IronRuby scripts in it. None of which is really exploiting the dynamic nature of IronRuby. Apparently its against our corporate standard to be using IronRuby or IronPython right now. Ooopps. Wha...

IronRuby - how to require .NET assemblies without strong name?

This page on the IronRuby help website talks about being able to 'require' some well-known assemblies such as System.Windows.Forms without needing to crank out the entire 'ah-come-on-gimme-a-break-here-you-cannot-be-serious' strong name of the assembly. In the docs it says this: >>> require "System.Windows.Forms" => true But when...

IronRuby System.DateTime NilClass

Why comparing to null is so unstable? Just code. IronRuby 0.9.4.0 on .NET 2.0.50727.4927 Copyright (c) Microsoft Corporation. All rights reserved. >>> require 'System' => true >>> i = System::Int32.MinValue => -2147483648 >>> i==nil => false >>> d = System::DateTime.Now => 11.02.2010 14:15:02 >>> d==nil (ir):1: can't convert NilClass ...

Ruby: targeting multiple platforms in one project

Hello, fellow Rubyists! I am creating an [Iron]Ruby project that needs to support several environments (more specifically, WPF, Silverlight, and WinForms - but that's not as important). The following is an actual, concrete example of where I'm stuck: I have to implement a Bitmap class as part of a library, and this class will need to b...

Ruby .each with removal of items in collection

I am currently working with an app that allows for runtime addition and removal of items in a drop down list via a rub script. The Ruby looks like this SAFE = ; return control if control.CyclesCount == 0; control.Items.each{|item| control.Items.Remove(item) if item.Value.index('|').nil?}; return control; control is custom user cont...

How to use an IronRuby block with a C# method

I'm using IronRuby and trying to work out how to use a block with a C# method. This is the basic Ruby code I'm attempting to emulate: def BlockTest () result = yield("hello") puts result end BlockTest { |x| x + " world" } My attempt to do the same thing with C# and IronRuby is: string scriptText = "csharp.BlockTest { |arg| arg...

Use an IronRuby wrapper method to get a block into C#

I'm using IronRuby and trying to come up with a seamless to pass a block to C#. This question is a follow on from How to use an IronRuby block in C# which indicates blocks cannot be passed between IronRuby and C#. My subsequent question is as to whether there's a way to acheive the same goal using a Ruby wrapper method to make the block...

IronRuby: Cannot call method on a COM Object with one or more arguments.

When I try and call any method on a COM Object that takes one or more arguments, I get the following error on the last argument: Could not convert argument 0 for call to Open. (ArgumentError) Everything works fine when calling a method that takes no arguments, or getting/setting a property. Here is the code that gives me the error abo...

Passing .Net Stream into IronRuby?

I am using IronRuby to parse Yaml files and then use the parsed document in C#. This is working fine for creating an engine (Ruby.CreateEngine()), and executing the YAML::load(File.open('myFile.yaml')). But, this works well because I can hard-code a string for the file name when I execute a few lines of ruby code. Now, I want to under...

Running DLR Embedded Scripts in Minimum Security Context

I need to get pointed in the right direction. I have embedded an Iron Python scripting host into a simple C# application, but now I need to know the best practices for locking down security on a user generated IronPython or IronRuby script. Specifically, what are the strategies for preventing library imports and isn't there a way in .NE...

How do I pass an ExpandoObject from C# into IronRuby?

Executing the below code gives me the following exception on the last line: InvalidOperationException: "unbound variable: value" var rubyRuntime = Ruby.CreateRuntime(); rubyRuntime.UseFile("HandleMoveRequested.rb"); var engine = rubyRuntime.GetEngine("rb"); dynamic ruby = engine.Runtime.Globals; var handler = ruby.HandleMoveRequested....

Why do 'requires' statements fail when loading (iron)ruby script via a C# program?

IronRuby and VS2010 noob question: I'm trying to do a spike to test the feasibility of interop between a C# project and an existing RubyGem rather than re-invent that particular wheel in .net. I've downloaded and installed IronRuby and the RubyGems package, as well as the gem I'd ultimately like to use. Running .rb files or working i...

IronRuby and XAML Databinding

Does anyone know if Microsoft plans on implementing XAML (declarative) databinding of IronRuby objects for Silverlight and WPF? Without it, using IronRuby for Silverlight/WPF development really isn't all that compelling (IMO). ...

Capturing Standard Output from an IronRuby Script using the DLR APIs

I have a very simple test.rb file: puts "Hello World" I want to execute this file within c#, eg: var runtime = Ruby.CreateRuntime(); runtime.ExecuteFile("C:\test.rb"); How can I capture the "Hello World"? ...

DirectX in IronRuby

I'm thinking about writing a game using DirectX, and I'm considering using IronRuby. Is IronRuby stable enough to use in production? Does IronRuby work well with DirectX? ...

Storing ASP.Net MVC Views in the Database

For an ASP.Net MVC application, I'm interested in storing some views and/or partial views in the database so that a few semi-technical users can do some basic view logic. Does anyone have any tips or lessons from experience on doing this? I know Phil Haack wrote a blog post on this about a year ago. He used IronRuby for scripting his vi...

Calling C# object method from IronPython

I'm trying to embed a scripting engine in my game. Since I'm writing it in C#, I figured IronPython would be a great fit, but the examples I've been able to find all focus on calling IronPython methods in C# instead of C# methods in IronPython scripts. To complicate things, I'm using Visual Studio 2010 RC1 on Windows 7 64 bit. IronRuby...

Pass an array from IronRuby to C#

I'm sure this is an easy fix and I just can't find it, but here goes: I have a C# class (let's call it Test) in an assembly (let's say SOTest.dll). Here is something along the lines of what I'm doing: private List<string> items; public List<string> list_items() { return this.items; } public void set_items(List<string> new_items) ...

Any way to add my C# project as a reference in IronPython / IronRuby?

I know how to reference an existing .dll to IronPython, but is there any way to add my project as a reference like I can between Visual Studio projects? Or is it best practice to create a separate class library? ...