hi guys I am trying to read the YAML documents however it is giving me
error.
My YAML file is as below
scenario:noPassword
username:gaurang
password:
scenario:noUsername
username:
password:gaurang
And ruby file in which I am reading is like this
require ‘yaml’
class ReadData
config = YAML.load_file(“data.yaml”)
p config[“noPassword”][“username”]
p config[“noPassword”][“password”]
end
When i run the above class it gives me following error.
undefined method `[]’ for nil:NilClass (NoMethodError)
Any idea why I am getting this error ???