Up until now, RubyCLR did not support finding types in the top-level (global) namespace. If you were writing code that used types in the global namespace (which you will if you don’t scope things by namespace – typically for your own libraries), it wouldn’t work correctly.
I had punted on this bug for a while but finally had to fix it when I added JScript.NET compilation support to RubyCLR today. JScript.NET does not support declaring types in namespaces (as far as I can tell – I’m by no means a JScript.NET dev).
It required refactoring how I handled the boundary case of a type that wasn’t scoped by a Ruby Module.
So this code finally works:
inline :jscript do |compiler|
compiler.compile <<-EOF
class JScriptClass {
function sayHello() {
return "hello"
}
}
EOF
end
def test_inline_jscript
assert_equal 'hello', JScriptClass.new.sayHello
end
1 archived reader comment
Fatih Orhan (2006-04-05)
Looking really nice. So with ability to inline C# (and JScript.NET), i can design forms in VS.NET IDE, inline some Designer generated code in my beloved Ruby and bind some events to it. oooh i can’t wait :) when can we get it? And thank you for this, you filling a very needed gap with your bridge (eheh), i appreciate that. sorry if parts of this message didn’t make sense, english is not my native language.