Yaml-block-sequences

提供:Dev Guides
移動先:案内検索

YAML-ブロックシーケンス

The block sequences of YAML represent a series of nodes. Each item is denoted by a leading “-“ indicator. Note that the “-“ indicator in YAML should be separated from the node with a white space.

ブロックシーケンスの基本的な表現は以下のとおりです-

block sequence:
··- one↓
  - two : three↓

ブロックシーケンスをよりよく理解するには、次の例をご覧ください。

例1

port: &ports
  adapter:  postgres
  host:     localhost

development:
  database: myapp_development
  <<: *ports

JSON形式のブロックシーケンスの出力は以下のとおりです-

{
   "port": {
      "adapter": "postgres",
      "host": "localhost"
   },
   "development": {
      "database": "myapp_development",
      "adapter": "postgres",
      "host": "localhost"
   }
}