加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – YAML中的多级嵌套

发布时间:2020-12-16 21:36:37 所属栏目:百科 来源:网络整理
导读:我试图使用YAML创建在应用程序中使用的所有存储过程的列表,以及从哪里调用它们.我想像下面的东西,但我认为YAML不允许多层次的嵌套. access_log: stored_proc: getsomething uses: usedin: some-bread-crumb usedin: something else here stored_proc: anothe
我试图使用YAML创建在应用程序中使用的所有存储过程的列表,以及从哪里调用它们.我想像下面的东西,但我认为YAML不允许多层次的嵌套.
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

有没有办法在YAML这样做,如果没有,还有什么其他选择?

解决方法

这正是我在YAML中使用嵌套级别的Perl脚本的配置文件. This YAML Tutorial可能是您在Ruby中如何处理所需结构的良好参考.

我想你的问题是尝试混合类型.我建议修改如下:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读