Ruby – Multiple level nesting in YAML

rubyyaml

I'm trying to use YAML to create list of all stored procs used in an application and from where they are called. I envisioned something like below but I think YAML does not allow multiple level nesting.

access_log:
  stored_proc: getsomething
    uses:
      usedin: some->bread->crumb
      usedin: something else here
  stored_proc: anothersp
    uses:
      usedin: blahblah

reporting:
  stored_proc: reportingsp
    uses:
      usedin: breadcrumb

Is there a way to do this in YAML and if not, what other alternatives are there?

Best Solution

That's exactly how I've used nested levels in YAML for configuration files for perl scripts. This YAML Tutorial might be a good reference for you on how to handle the structure you want in Ruby.

I think your problem is trying to mix types. I suggest revising like this:

reporting:
  stored_procs:
    reportingsp
      uses:
        usedin: breadcrumb
    secondProc
      uses:
        usedin: something_else