Say I have a YAML file:
---
foo:
bar:
baz:
- a
- b
And I want to attempt to loop through an array that might possibly be found as a value for foo['bar']
in Python:
for i in foo['baz']:
print(i)
Normally, Python would behave as if there is nothing to loop through and continue on from that particular code.
But, with similar code from Ruby:
for i in foo['baz']
puts i
end
I receive a NoMethodError exception and the script halts entirely. How do you make Ruby behave like the Python example above?