Skip to content

Instantly share code, notes, and snippets.

@nrk
Created May 3, 2009 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrk/105928 to your computer and use it in GitHub Desktop.
Save nrk/105928 to your computer and use it in GitHub Desktop.
IronRuby 0.4.0.0 on .NET 2.0.50727.4918
Copyright (c) Microsoft Corporation. All rights reserved.
>>> load_assembly "test"
=> true
>>> source = open("data.xml")
=> #<File:data.xml>
>>> Test::Nrk.read(source)
C:\Development\ironruby\working-nrk\ndp\fx\src\Core\Microsoft\Scripting\Actions\DynamicMetaObjectBinder.cs:87:in `Bind': The result type 'System.Object' of the binder 'read(C,0)' is not compatible with the result type 'IronRuby.Builtins.MutableString' expected by the call site. (TypeError)
from C:\Development\ironruby\working-nrk\ndp\fx\src\Core\Microsoft\Scripting\Actions\C
allSiteBinder.cs:79:in `BindDelegate'
from :0:in `read'
from :0
using System;
using System.Runtime.CompilerServices;
using IronRuby.Builtins;
using IronRuby.Runtime;
using IronRuby.Runtime.Calls;
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
namespace Test {
using RubyIOReadCallSite = CallSite<Func<CallSite, RubyIO, MutableString>>;
[RubyModule("Nrk")]
public static class Nrk {
[RubyMethod("read")]
public static MutableString Read(RubyIO/*!*/ source) {
RubyCallSignature callSignature = RubyCallSignature.Simple(0);
RubyCallAction callAction = RubyCallAction.MakeShared("read", callSignature);
var readCallSite = RubyIOReadCallSite.Create(callAction);
return readCallSite.Target(readCallSite, source);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment