I have an object
variable that have the following value:
[
{"a"=>nil, "b"=>79, "c"=>"mg/dL", "d"=>"high", "e"=>false},
{"a"=>80, "b"=>139, "c"=>"mg/dL", "d"=>"low", "e"=>true},
{"a"=>140, "b"=>199, "c"=>"mg/dL", "d"=>"moderate", "e"=>false},
{"a"=>200, "b"=>nil, "c"=>"mg/dL", "d"=>"high", "e"=>false}
]
I am trying to pass the index and get the value of the key d
but the code crash
object.as_json.each_with_index.map { |range, i| range[i].d }
I get undefined method d
for the statement above
How can I get the values of "d"
?