aetherknight / recursive-open-struct

OpenStruct subclass that returns nested hash attributes as RecursiveOpenStructs
Other
276 stars 54 forks source link

on ruby 2.3.1 recurse_over_arrays doesnt work #48

Closed kubenstein closed 7 years ago

kubenstein commented 7 years ago

hi, recently i switched to newer ruby in one of my project and noticed recurse_over_arrays option doesnt work any longer. Looks like it still is just a hash. Im not sure how it is on other ruby versions.

Thank you

2.3.1 :001 > require 'recursive-open-struct'
 => true 
2.3.1 :002 > ros = RecursiveOpenStruct.new({array: [{field: 'value'}]}, recurse_over_arrays: true)
 => #<RecursiveOpenStruct array=[{:field=>"value"}]> 
2.3.1 :003 > ros.array[0].field
NoMethodError: undefined method `field' for {:field=>"value"}:Hash
    from (irb):3
    from /Users/kuba/.rvm/rubies/ruby-2.3.1/bin/irb:11:in `<main>'
31piy commented 7 years ago

@kubenstein Which revision are you using? I used ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] and run the same code. Found that it is working.

kubenstein commented 7 years ago

hey hey i reinstalled everything, not sure what version of the gem I was using, should have included this in the pr, BUT with recursive-open-struct-1.0.1 and on ruby ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14] all is working again. thank you and sorry for false alert.