Can't read Yaml for domain type

I have one yaml file “content.yml” which has content,


key: !DBClass
debug: Y
Directory : /var/tmp
name: John
phone: 487394

As, I am trying to load the file via,

obj= YAML.load(File.open(“content.yml”))

But i dont know that how to acess the individual variable from this
content.
for eg, How do i will get the Directory or name or phone ?

Ganesh Girase wrote:

As, I am trying to load the file via,

obj= YAML.load(File.open(“content.yml”))

But i dont know that how to acess the individual variable from this
content.
for eg, How do i will get the Directory or name or phone ?

There should be some code that defines the DBClass type for YAML (maybe
you can check with whoever wrote that data?). In the meantime, you can
do this:

require ‘yaml’

h = YAML.load(DATA)[“key”].instance_variable_get(:@value)

p h # {“name”=>“John”, “Directory”=>"/var/tmp", “phone”=>487394,
“debug”=>“Y”}

p h[“Directory”] # “/var/tmp”

END


key: !DBClass
debug: Y
Directory : /var/tmp
name: John
phone: 487394