Created
May 3, 2009 09:46
-
-
Save nrk/105928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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