I have a nested hash like :-
profile:
status:
nil: 3
x: 2
priority:
x: 2
y: 2
Is there a way of setting the default value for status like:-
profile:
status:
default:0
nil: 3
x:2
I dont want solutions like these or any other method :-
h = Hash.new("Go Fish")
h.default = "Go fish"
coz I have a yml file loaded with configs hash and other mapping hashes, like the status, priority mapping above. So my script extracts the configs as well as the other hash values from these yml and use them. Now for the status and priority mapping, I need this status and priority subhash to return a value if it doesnt find any matching symbol(i.e,. if no such mapping exists) inside this hash. I can set that default value in the code using the other methods. But the whole point is I want any layman to edit this yml and be able run my script. Hence I want the default values to be set here.
Since none seem to come up with an alternative, for now I have resorted to this method.
in the code