當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Ruby Handler.start_document用法及代碼示例

本文簡要介紹ruby語言中 Psych::Handler.start_document 的用法。

用法

start_document(version, tag_directives, implicit)

如果文檔是 implicit ,則在文檔以聲明的 versiontag_directives 開頭時調用。

version 將是一個整數數組,表示正在處理的 YAML 版本,tag_directives 是一個元組列表,表示每個標簽的前綴和後綴,implicit 是一個布爾值,表示文檔是否隱式啟動.

示例

給定以下 YAML:

%YAML 1.1
%TAG ! tag:tenderlovemaking.com,2009:
--- !squee

start_document 的參數必須是這樣的:

version         # => [1, 1]
tag_directives  # => [["!", "tag:tenderlovemaking.com,2009:"]]
implicit        # => false

相關用法


注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Handler.start_document。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。