No, even in pure ruby code you must use .call to execute a function stored in a variable
eg: f = lambda{ |x| puts x } f.call(5) # cannot simply use f(5) This is a side effect of ruby's syntax which allows you to call methods without brackets surrounding the arguments ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwa...@gallagher.co | WEB www.gallagher.co From: Konstantin Kos <li...@ruby-forum.com> To: ironruby-core@rubyforge.org Date: 21/11/2012 09:25 a.m. Subject: [Ironruby-core] IronRuby hosting - executing C# method Sent by: ironruby-core-boun...@rubyforge.org Hi, I have some issue with hosting IronRuby in C# application. I've created Ruby ScriptEngine, created ScriptScope with delegate in it: > C# > scope.SetVariable("func", new Action<object>(MyMethod)); but can't execute "func" from script > Ruby > func("argument") fails with ArgumentException "wrong number of arguments (1 for 0)" but can run it by calling "invoke": > Ruby > func.invoke("argument") is it possible to execute Delegate like normal ruby function? -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core ########################################################################### This e-mail is confidential and may contain information subject to legal privilege. If you are not the intended recipient please advise us of our error by return e-mail then delete this e-mail and any attached files. You may not copy, disclose or use the contents in any way. The views expressed in this e-mail may not be those of Gallagher Group Ltd or subsidiary companies thereof. ###########################################################################
<<image/gif>>
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core