R93 update

I had written a small “hello world” app that read a ruby file, using
IronRuby.

It used this “puts “Ruby and ${variable} together at last”” where
“variable” is a global assigned in the C# program.

The program I’d written stopped compiling after the update so I looked
on the Wiki for changes.

The Wiki shows this example
http://ironruby.rubyforge.org/wiki/wiki.pl?ExecutingIronRubyFromCSharp

From that example, this line

ctx.GlobalVariables[SymbolTable.StringToId("variable")] = ".NET";

doesn’t work because the index on GlobalVariables has changed to a
KeyValuePair

A, I’m confused about how to create a GlobalVariable object to put in
that collection. B, I’m unsure if I’m headed down the right path,
given the changes to the API. Is there a “New” way to assigned global
variables?

Any help is greatly appreciated.


Greg A.
Software Development Manager
SSI Services

http://kc.vanadium.com
http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

I have had following working ok with the recent IR iterations:

    public object GetGlobalVar(string varName)
    {
        return ExecutionContext.GetGlobalVariable(varName);
    }

    public void SetGlobalVar(string varName, object value)
    {
        ExecutionContext.DefineGlobalVariable(varName, value);
    }

It indeed changed few iterations ago and broke my earlier code as well.

Robert B.
Software architect
Napa Ltd
Tammasaarenkatu 3, Helsinki FI-00180
P.O.Box 470, Helsinki FI-00181

Tel. +358 9 22 813 1
Direct. +358 9 22 813 611
GSM +358 45 11 456 02
Fax. +358 9 22 813 800

Email: [email protected]
www.napa.fi

On Wed, Apr 9, 2008 at 11:54 AM, Robert B.
[email protected] wrote:

    }

It indeed changed few iterations ago and broke my earlier code as well.

Thanks. That also helped me find some relevant tests that gave me a
little more information about what’s happening there.

I appreciate your help.


Greg A.
Software Development Manager
SSI Services

http://kc.vanadium.com
http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs