I am developing a rabbi application in which to include multiple transmission methods to reach a complex hash with an array Need to have copper To reach with the method of sending the hash elements, I am using Hashugar gem. For example:
hash = {one: 1, two: 2, and more: [{three: 3}, {four: 4}}} .to_hashugar keys = ['more' , 'First', 'three'] are the first elements of the # 'first' array hash.send (* keys) #Failed
I try it to work in different ways But I can not do this, is there any possibility of achieving this? If I want to remove Hashugar, then it does not matter.
In advance thanks
You can use here:
< Pre> keys.inject (hash) {| M, key | M.send (key)}
No comments:
Post a Comment