In ruby, I have
res = [[0, :product, "client"], [0, :os, "windows"], [0, :architecture, "32rs"]]
I want to get value of os. I can do it by res[1][2], but I don’t want to rely on the index as it can change. What I have is the key i.e. :os, so what is the best way to find it?
Assuming you can’t change the way the data is structured, you could do something like this:
But it seems to me that your data is better represented with a hash.
Then you can access discrete data properties like this: