English 中文(简体)
何种数据结构?
原标题:What kind of data structure is this?

我正在把最近的承诺从阴暗中拉出来,并试图用废墟来 par。 我知道,我可以人工调节,但我想看一下,是否有一揽子方案能够将它变成一个散射或另一个数据结构。

commits: 
- parents: 
  - id: 202fb79e8686ee127fe49497c979cfc9c9d985d5
  author:
    name: This guy
    login: tguy
    email: tguy@tguy.com
  url: a url
  id: e466354edb31f243899051e2119f4ce72bafd5f3
  committed_date: "2010-07-19T13:44:43-07:00"
  authored_date: "2010-07-19T13:33:26-07:00"
  message: |-
    message
- parents: 
  - id: c3c349ec3e9a3990cac4d256c308b18fd35d9606
  author: 
    name: Other Guy
    login: oguy
    email: oguy@gmail.com
  url: another url
  id: 202fb79e8686ee127fe49497c979cfc9c9d985d5
  committed_date: "2010-07-19T13:44:11-07:00"
  authored_date: "2010-07-19T13:44:11-07:00"
  message: this is another message
问题回答

http://ruby-doc.org/french/states/YAML.html” rel=“nofollow noreferer” http://ruby-doc.org/french/states/YAML.html。 您可以做如下事情:obj = YAML:load yaml_string。 (和在你档案的顶端,在标准校准上,需要Yaml ,然后作为nes。)

在废墟世界中,人民在 j/c世界中使用XML的方式基本上得到了使用。

看像阿马齐。 有许多语言的教授。 例如,与Ruby的AYAML图书馆包括:

data = <<HERE
commits: 
- parents: 
  - id: 202fb79e8686ee127fe49497c979cfc9c9d985d5
  author:
    name: This guy
    login: tguy
    email: tguy@tguy.com
  url: a url
  id: e466354edb31f243899051e2119f4ce72bafd5f3
  committed_date: "2010-07-19T13:44:43-07:00"
  authored_date: "2010-07-19T13:33:26-07:00"
  message: |-
    message
- parents: 
  - id: c3c349ec3e9a3990cac4d256c308b18fd35d9606
  author: 
    name: Other Guy
    login: oguy
    email: oguy@gmail.com
  url: another url
  id: 202fb79e8686ee127fe49497c979cfc9c9d985d5
  committed_date: "2010-07-19T13:44:11-07:00"
  authored_date: "2010-07-19T13:44:11-07:00"
  message: this is another message
HERE

pp YAML.load data

文件:

{"commits"=>
  [{"author"=>{"name"=>"This guy", "login"=>"tguy", "email"=>"tguy@tguy.com"},
    "parents"=>[{"id"=>"202fb79e8686ee127fe49497c979cfc9c9d985d5"}],
    "url"=>"a url",
    "id"=>"e466354edb31f243899051e2119f4ce72bafd5f3",
    "committed_date"=>"2010-07-19T13:44:43-07:00",
    "authored_date"=>"2010-07-19T13:33:26-07:00",
    "message"=>"message"},
   {"author"=>
     {"name"=>"Other Guy", "login"=>"oguy", "email"=>"oguy@gmail.com"},
    "parents"=>[{"id"=>"c3c349ec3e9a3990cac4d256c308b18fd35d9606"}],
    "url"=>"another url",
    "id"=>"202fb79e8686ee127fe49497c979cfc9c9d985d5",
    "committed_date"=>"2010-07-19T13:44:11-07:00",
    "authored_date"=>"2010-07-19T13:44:11-07:00",
    "message"=>"this is another message"}]}




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签