Re: [Ironruby-core] Problem with using OpenStruct and ERB

2012-10-03 Thread Badr A.
[http://www.anisaty.com/vb/ منتدى انستي] 
[http://www.anisaty.com/vb/t71806.html العاب باربي الصينية] 
[http://www.anisaty.com/vb/t71783.html العاب باربي] 
[http://www.anisaty.com/vb/t71821 العاب تلبيس باربي الدلوعه] 
[http://www.anisaty.com/vb/f8/ منتديات عالم حواء] 
[http://www.anisaty.com/vb/f9/ ازياء 2013] 
[http://www.anisaty.com/vb/f10/ اكسسوارات 2013] 
[http://www.anisaty.com/vb/f11/ مكياج 2013] 
[http://www.anisaty.com/vb/f12/ تسريحات شعر 2013] 
[http://www.anisaty.com/vb/f16/ العروس ومتطلباتها] 
[http://www.anisaty.com/vb/f14/ فساتين للبيع] 
[http://www.anisaty.com/vb/f111/ ديكورات 2013] 
[http://www.anisaty.com/vb/f19/ منتديات الاسره والطفل] 
[http://www.anisaty.com/vb/f20/ صحة الاسرة] 
[http://www.anisaty.com/vb/f112/ صحة المرأة] 
[http://www.anisaty.com/vb/f22/ صحة الطفل] 
[http://www.anisaty.com/vb/f113/ العنايه بالجسم والبشره] 
[http://www.anisaty.com/vb/f114/ عالم الحياة الزوجيه] 
[http://www.anisaty.com/vb/f115/ صحة الحامل] 
[http://www.anisaty.com/vb/f118/ زفات بنات 2013] 
[http://www.anisaty.com/vb/t71267.html صيحه الملابس] 
[http://www.anisaty.com/vb/t71229.html ارق العبايات لاجمل بنوتات] 
[http://www.anisaty.com/vb/t71158.html فساتين قصيره للبنات] 
[http://www.anisaty.com/vb/t71076.html جاكيتات شتوية] 
[http://www.anisaty.com/vb/t71075.html فساتين سهره تل] 
[http://www.anisaty.com/vb/t71074.html فساتين زفاف رامى قادى] 
[http://www.anisaty.com/vb/t71070.html صور جلابيات مغربية] 
[http://www.anisaty.com/vb/t71069.html صور جلابيات مغربية] 
[http://www.anisaty.com/vb/t71068.html موديلات مراييل] 
[http://www.anisaty.com/vb/t71067.html فساتين سهرات ايلي صعب] 
[http://www.anisaty.com/vb/t71066.html ازياء غراند] 
[http://www.anisaty.com/vb/t71064.html فساتين شتاء طويلة] 
[http://www.anisaty.com/vb/t71062.html ازياء سلفاتوري فيراغامو] 
[http://www.anisaty.com/vb/t71060.html فساتين سلفاتوري فيراغامو] 
[http://www.anisaty.com/vb/t71058.html عبايات المتحجبة] 
[http://www.anisaty.com/vb/t71056.html فساتين منوعة] 
[http://www.anisaty.com/vb/t71054.html بنطلونات ملونة] 
[http://www.anisaty.com/vb/t71053.html فساتين مخمل] 
[http://www.anisaty.com/vb/t71052.html الحجاب السعودي] 
[http://www.anisaty.com/vb/t71049.html فساتين بالفرو] 
[http://www.anisaty.com/vb/t71047.html فساتين ايتوال لابوتيك] 
[http://www.anisaty.com/vb/t70694.html تشكيلة جديده من عبايات خلييجي] 
[http://www.anisaty.com/vb/t70692.html بنطلونات سكيني الوان] 
[http://www.anisaty.com/vb/t70688.html جلابيات آخر موضة] 
[http://www.anisaty.com/vb/t70686.html جلابيات للمحجبات شيك] 
[http://www.anisaty.com/vb/t71871.html حقائب ماركة براد] 
[http://www.anisaty.com/vb/t71867.html صنادل باللون الفضى] 
[http://www.anisaty.com/vb/t71864.html شنط روعة للبنات] 
[http://www.anisaty.com/vb/t71859.html احدث شنط] 
[http://www.anisaty.com/vb/t71855.html اكسيسوارات مجوهرات] 
[http://www.anisaty.com/vb/t71852.html نظارات ريبان انيقه] 
[http://www.anisaty.com/vb/t71849.html كوليكشن شنط سهرة تحفة] 
[http://www.anisaty.com/vb/t71844.html احدث مجموعه خواتم] 
[http://www.anisaty.com/vb/t71843.html موضة اكسسوارات روعة] 
[http://www.anisaty.com/vb/t71842.html احدث مجموعه ساعات] 
[http://www.anisaty.com/vb/t71841.html اساور للبنات] 
[http://www.anisaty.com/vb/t71840.html اكسسوارات للشعر] 
[http://www.anisaty.com/vb/t71838.html ارقى اكسسوارات جديدة] 
[http://www.anisaty.com/vb/t71836.html اكسسوار رقيق للجميلات] 
[http://www.anisaty.com/vb/t71835.html مجموعه اساور للبنات] 
[http://www.anisaty.com/vb/t71833.html خواتم بأحجار كريمه] 
[http://www.anisaty.com/vb/t71831.html احلى اكسسوارات بناتيه] 
[http://www.anisaty.com/vb/t71830.html اجمل كولكشن مجوهرات للبنات] 
[http://www.anisaty.com/vb/t71828.html احلى تشكيلة اكسسوارات ناعمه] 
[http://www.anisaty.com/vb/t71826.html ارقى اكسسورارت موضة] 
[http://www.anisaty.com/vb/t71824.html اشيك موديلات] 
[http://www.anisaty.com/vb/t71823.html نظارات من ديور] 
[http://www.anisaty.com/vb/t71820.html خواتم للخطوبه] 
[http://www.anisaty.com/vb/t71819.html خواتم منوعة للبنات] 
[http://www.anisaty.com/vb/t71815.html اساور مودرن للبنات] 
[http://www.anisaty.com/vb/t71208.html فساتين زفاف قمة فى الروعه] 
[http://www.anisaty.com/vb/t71016.html المنطقه الحساسه] 
[http://www.anisaty.com/vb/t71013.html نصائح لاختيار فستان زفافك] 
[http://www.anisaty.com/vb/t71011.html غلطات العرائس] 
[http://www.anisaty.com/vb/t71008.html خلطة العروس] 
[http://www.anisaty.com/vb/t71006.html فترة الخطوبة] 
[http://www.anisaty.com/vb/t70923.html بجامات حرير تحفة] 
[http://www.anisaty.com/vb/t70916.html انواع الغيرة] 
[http://www.anisaty.com/vb/t70912.html ازاى تتعاملى مع حماتك] 
[http://www.anisaty.com/vb/t70911.html خاتمك دليل على شخصيتك] 
[http://www.anisaty.com/vb/t70861.html ازاى تتعاملى مع خطيبك وانتى 
مضايقة] [http://www.anisaty.com/vb/t70712.html تسريحة ومكياج ب 250 ريال 
في المدينة المنورة] [http://www.anisaty.com/vb/t69718.html احدث فساتين 
زفاف] [http://www.anisaty.com/vb/t69598.html قفازات للعروس الدانتيل] 
[http://www.anisaty.com/vb/t69595.html تسريحات شعر للعروس] 
[http://www.anisaty.com/vb/t69592.html مساكات ورد جديدة] 

Re: [Ironruby-core] Problem with using OpenStruct and ERB

2012-06-22 Thread Nathan Standiford
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-boun...@rubyforge.org
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards
Sent: Tuesday, June 19, 2012 4:20 PM
To: ironruby-core@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'}) 
= #OpenStruct foo=bar 
irb(main):021:0 ostruct_binding = ostruct.send(:binding) 
= #Binding:0x2545dd0 
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.edwa...@gallagher.co | WEB www.gallagher.co  



From:        Nathan Standiford nstan...@live.com 
To:        ironruby-core@rubyforge.org 
Date:        20/06/2012 10:53 a.m. 
Subject:        Re: [Ironruby-core] Problem with using OpenStruct and ERB 
Sent by:        ironruby-core-boun...@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-boun...@rubyforge.org
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards
Sent: Tuesday, June 19, 2012 2:23 PM
To: ironruby-core@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.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


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


[Ironruby-core] Problem with using OpenStruct and ERB

2012-06-19 Thread Nathan Standiford
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


Re: [Ironruby-core] Problem with using OpenStruct and ERB

2012-06-19 Thread Orion Edwards
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


Re: [Ironruby-core] Problem with using OpenStruct and ERB

2012-06-19 Thread Nathan Standiford
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-boun...@rubyforge.org
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards
Sent: Tuesday, June 19, 2012 2:23 PM
To: ironruby-core@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.edwa...@gallagher.co | WEB  http://www.gallagher.co/
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
http://rubyforge.org/mailman/listinfo/ironruby-core

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


Re: [Ironruby-core] Problem with using OpenStruct and ERB

2012-06-19 Thread Orion Edwards
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'})
= #OpenStruct foo=bar
irb(main):021:0 ostruct_binding = ostruct.send(:binding)
= #Binding:0x2545dd0
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.edwa...@gallagher.co | WEB www.gallagher.co  




From:   Nathan Standiford nstan...@live.com
To: ironruby-core@rubyforge.org
Date:   20/06/2012 10:53 a.m.
Subject:Re: [Ironruby-core] Problem with using OpenStruct and ERB
Sent by:ironruby-core-boun...@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-boun...@rubyforge.org [
mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards
Sent: Tuesday, June 19, 2012 2:23 PM
To: ironruby-core@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.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
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

image/gifimage/gif___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core