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.edwa...@gallagher.co | WEB www.gallagher.co  




From:   Nathan Standiford <nstan...@live.com>
To:     <ironruby-core@rubyforge.org>
Date:   20/06/2012 04:55 a.m.
Subject:        [Ironruby-core] Problem with using OpenStruct and ERB
Sent by:        ironruby-core-boun...@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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

<<image/gif>>

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to