You seem to be attempting to use “=>” to access a value for a key. If
so, that is not the correct syntax.
What does your test code look like?
currently to access “i1” value I have to write:
ids[“signin”][“element1”][“ios_id”] = “i1”
so now, what I am trying to achieve is,
I have 2 values for ids, ios_id and android_id. I have to iterate over
the ids and build new hash which would be like:
ids[“sign”][“element1”] having value “i1”.
means new hash will be having all ios_id value for all element.
ids.each do |key, value|
value.each do |k, v|
new_id_hash[“signin”] = Hash.new
if v.has_key?(“ios_id”) then
[ Insert the value of ios_id key to new_id_hash ]
[ new_id_hash[“signin”][“element1”] = “i1”]
end
end
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.