From ironruby at monnet-usa.com Sun Jun 3 17:38:43 2012 From: ironruby at monnet-usa.com (Philippe Monnet) Date: Sun, 03 Jun 2012 11:38:43 -0600 Subject: [Ironruby-core] Support for ActiveRecord 3.2 Message-ID: <4FCBA123.5080208@monnet-usa.com> An HTML attachment was scrubbed... URL: From antonfir at gmail.com Wed Jun 6 14:16:29 2012 From: antonfir at gmail.com (Anton Firsov) Date: Wed, 6 Jun 2012 16:16:29 +0200 Subject: [Ironruby-core] ScriptRuntime.Operations.CreateInstance() is very slow Message-ID: Hi all, I use IronRuby as a scripting environment inside my c# app. I have to create instances of ruby objects inside c# code, and I'm doing it with ScriptRuntime.Operations.CreateInstance(). It's the largest performance bottleneck in my app currently. Is there any workaround? Will it be faster, if I create ruby functions which instantiate my objects, and call these function instead of ScriptRuntime.Operations.CreateInstance()? The ruby classes are subclasses of my clr classes. Thanks, Anton -------------- next part -------------- An HTML attachment was scrubbed... URL: From nstandif at live.com Tue Jun 19 16:51:36 2012 From: nstandif at live.com (Nathan Standiford) Date: Tue, 19 Jun 2012 09:51:36 -0700 Subject: [Ironruby-core] Problem with using OpenStruct and ERB Message-ID: I am using OpenStructs and ERB for template generation. In this simple example, ruby 1.8.6 runs this fine: require "erb" require "ostruct" puts ERB.new("<%=foo%>", 0, "%<>").result(OpenStruct.new({ :foo => "bar" }).send(:binding)) However, it generates the following error when I run this in IronRuby 1.1.3.0 on .NET 4.0.30319.269: (erb):2: undefined method `foo' for main:Object (NoMethodError) Does anyone know how to get this to behave correctly in IronRuby? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Orion.Edwards at gallagher.co Tue Jun 19 21:22:42 2012 From: Orion.Edwards at gallagher.co (Orion Edwards) Date: Wed, 20 Jun 2012 09:22:42 +1200 Subject: [Ironruby-core] Problem with using OpenStruct and ERB In-Reply-To: References: Message-ID: I notice that in your example, you don't declare the local variable foo anywhere: If I run it verbatim, both MRI and IronRuby fail with undefined method foo (and fair enough, foo isn't defined). When I declare foo as a local variable, both MRI and IronRuby work fine for me. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co From: Nathan Standiford To: Date: 20/06/2012 04:55 a.m. Subject: [Ironruby-core] Problem with using OpenStruct and ERB Sent by: ironruby-core-bounces at rubyforge.org I am using OpenStructs and ERB for template generation. In this simple example, ruby 1.8.6 runs this fine: require "erb" require "ostruct" puts ERB.new("<%=foo%>", 0, "%<>").result(OpenStruct.new({ :foo => "bar" }).send(:binding)) However, it generates the following error when I run this in IronRuby 1.1.3.0 on .NET 4.0.30319.269: (erb):2: undefined method `foo' for main:Object (NoMethodError) Does anyone know how to get this to behave correctly in IronRuby? _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 3465 bytes Desc: not available URL: From nstandif at live.com Tue Jun 19 22:55:10 2012 From: nstandif at live.com (Nathan Standiford) Date: Tue, 19 Jun 2012 15:55:10 -0700 Subject: [Ironruby-core] Problem with using OpenStruct and ERB In-Reply-To: References: Message-ID: I am trying to send the binding of the OpenStruct object not the binding of main. I have been using this with MRI 1.8.6 for some time and works fine. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Tuesday, June 19, 2012 2:23 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Problem with using OpenStruct and ERB I notice that in your example, you don't declare the local variable foo anywhere: If I run it verbatim, both MRI and IronRuby fail with undefined method foo (and fair enough, foo isn't defined). When I declare foo as a local variable, both MRI and IronRuby work fine for me. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co From: Nathan Standiford To: Date: 20/06/2012 04:55 a.m. Subject: [Ironruby-core] Problem with using OpenStruct and ERB Sent by: ironruby-core-bounces at rubyforge.org _____ I am using OpenStructs and ERB for template generation. In this simple example, ruby 1.8.6 runs this fine: require "erb" require "ostruct" puts ERB.new("<%=foo%>", 0, "%<>").result(OpenStruct.new({ :foo => "bar" }).send(:binding)) However, it generates the following error when I run this in IronRuby 1.1.3.0 on .NET 4.0.30319.269: (erb):2: undefined method `foo' for main:Object (NoMethodError) Does anyone know how to get this to behave correctly in IronRuby? _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 3465 bytes Desc: not available URL: From Orion.Edwards at gallagher.co Tue Jun 19 23:19:32 2012 From: Orion.Edwards at gallagher.co (Orion Edwards) Date: Wed, 20 Jun 2012 11:19:32 +1200 Subject: [Ironruby-core] Problem with using OpenStruct and ERB In-Reply-To: References: Message-ID: Ahh I see. I don't have a copy of 1.8.6 handy to test on, but this definitely fails for MRI 1.9. It seems like getting the binding of an ostruct in 1.9 doesn't work for evaluating local variables. Perhaps they changed ostruct? Here's what happens for me: irb(main):020:0> ostruct = OpenStruct.new({:foo => 'bar'}) => # irb(main):021:0> ostruct_binding = ostruct.send(:binding) => # irb(main):022:0> eval("foo", ostruct_binding) NameError: undefined local variable or method `foo' for main:Object IronRuby 1.1 aims for compatibility with ruby 1.9 (and ships standard libraries such as ostruct from 1.9 also), so it is designed to fail with the same errors as MRI 1.9 I'm not sure what you can do to work around it, all the best. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co From: Nathan Standiford To: Date: 20/06/2012 10:53 a.m. Subject: Re: [Ironruby-core] Problem with using OpenStruct and ERB Sent by: ironruby-core-bounces at rubyforge.org I am trying to send the binding of the OpenStruct object not the binding of main. I have been using this with MRI 1.8.6 for some time and works fine. From: ironruby-core-bounces at rubyforge.org [ mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Tuesday, June 19, 2012 2:23 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Problem with using OpenStruct and ERB I notice that in your example, you don't declare the local variable foo anywhere: If I run it verbatim, both MRI and IronRuby fail with undefined method foo (and fair enough, foo isn't defined). When I declare foo as a local variable, both MRI and IronRuby work fine for me. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co From: Nathan Standiford To: Date: 20/06/2012 04:55 a.m. Subject: [Ironruby-core] Problem with using OpenStruct and ERB Sent by: ironruby-core-bounces at rubyforge.org I am using OpenStructs and ERB for template generation. In this simple example, ruby 1.8.6 runs this fine: require "erb" require "ostruct" puts ERB.new("<%=foo%>", 0, "%<>").result(OpenStruct.new({ :foo => "bar" }).send(:binding)) However, it generates the following error when I run this in IronRuby 1.1.3.0 on .NET 4.0.30319.269: (erb):2: undefined method `foo' for main:Object (NoMethodError) Does anyone know how to get this to behave correctly in IronRuby? _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 3465 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 3465 bytes Desc: not available URL: From nstandif at live.com Fri Jun 22 17:44:29 2012 From: nstandif at live.com (Nathan Standiford) Date: Fri, 22 Jun 2012 10:44:29 -0700 Subject: [Ironruby-core] Problem with using OpenStruct and ERB In-Reply-To: References: Message-ID: Yeah, that seems like it was the problem. I fixed it by defining the getter method directly in the object I was running the ERB file in. require "erb" def eval_field(field) field.each do |key, value| class << self; self; end.class_eval do define_method(key) { @field[key] } end end @field = field binding end ERB.new("<%= foo %>").result(eval_field({:foo => "bar"}) I find it odd that OpenStruct won't work, despite this code almost being almost identical to that of OpenStruct. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Tuesday, June 19, 2012 4:20 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Problem with using OpenStruct and ERB Ahh I see. I don't have a copy of 1.8.6 handy to test on, but this definitely fails for MRI 1.9. It seems like getting the binding of an ostruct in 1.9 doesn't work for evaluating local variables. Perhaps they changed ostruct? Here's what happens for me: irb(main):020:0> ostruct = OpenStruct.new({:foo => 'bar'}) => # irb(main):021:0> ostruct_binding = ostruct.send(:binding) => # irb(main):022:0> eval("foo", ostruct_binding) NameError: undefined local variable or method `foo' for main:Object IronRuby 1.1 aims for compatibility with ruby 1.9 (and ships standard libraries such as ostruct from 1.9 also), so it is designed to fail with the same errors as MRI 1.9 I'm not sure what you can do to work around it, all the best. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co ? From: ? ? ? ?Nathan Standiford To: ? ? ? ? Date: ? ? ? ?20/06/2012 10:53 a.m. Subject: ? ? ? ?Re: [Ironruby-core] Problem with using OpenStruct and ERB Sent by: ? ? ? ?ironruby-core-bounces at rubyforge.org ________________________________________ I am trying to send the binding of the OpenStruct object not the binding of main. ?I have been using this with MRI 1.8.6 for some time and works fine. ? From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Tuesday, June 19, 2012 2:23 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Problem with using OpenStruct and ERB ? I notice that in your example, you don't declare the local variable foo anywhere: If I run it verbatim, both MRI and IronRuby fail with undefined method foo (and fair enough, foo isn't defined). When I declare foo as a local variable, both MRI and IronRuby work fine for me. ______________________________________________________ Orion Edwards | Technical Leader PHONE +64 7 838 9800 | FAX +64 7 838 9801 | EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co ? From: ? ? ? ?Nathan Standiford To: ? ? ? ? Date: ? ? ? ?20/06/2012 04:55 a.m. Subject: ? ? ? ?[Ironruby-core] Problem with using OpenStruct and ERB Sent by: ? ? ? ?ironruby-core-bounces at rubyforge.org ________________________________________ I am using OpenStructs and ERB for template generation. In this simple example, ruby 1.8.6 runs this fine: require "erb" require "ostruct" puts ERB.new("<%=foo%>", 0, "%<>").result(OpenStruct.new({ :foo => "bar" }).send(:binding)) ? However, it generates the following error when I run this in IronRuby 1.1.3.0 on .NET 4.0.30319.269: (erb):2: undefined method `foo' for main:Object (NoMethodError) ? Does anyone know how to get this to behave correctly in IronRuby? _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org