本文簡要介紹ruby語言中 Psych::Handler.start_sequence
的用法。
用法
start_sequence(anchor, tag, implicit, style)
在序列開始時調用。
anchor
是與序列或 nil 關聯的錨點。 tag
是與序列或 nil 關聯的標簽。 implicit
一個布爾值,指示序列是否已隱式啟動。 style
是表示列表樣式的整數。
有關 style
的可能值,請參見 Psych::Nodes::Sequence
中的常量。
示例
這是一個 YAML
文檔,其中練習了可以調用此方法的大多數可能方式:
--- - !!seq [ a ] - &pewpew - b
上麵的 YAML
文檔由三個列表組成,一個包含兩個內部列表的外部列表。這是發送來表示這些列表的參數矩陣:
# anchor tag implicit style
[nil, nil, true, 1 ]
[nil, "tag:yaml.org,2002:seq", false, 2 ]
["pewpew", nil, true, 1 ]
相關用法
- Ruby Handler.start_mapping用法及代碼示例
- Ruby Handler.start_document用法及代碼示例
- Ruby Handler.scalar用法及代碼示例
- Ruby Handler.end_document用法及代碼示例
- Ruby Handler.alias用法及代碼示例
- Ruby Handle類用法及代碼示例
- Ruby Handle.new用法及代碼示例
- Ruby Hash.reject用法及代碼示例
- Ruby Hash shift()用法及代碼示例
- Ruby Hash.delete()用法及代碼示例
- Ruby Hash length()用法及代碼示例
- Ruby Hash.new用法及代碼示例
- Ruby Hash.size用法及代碼示例
- Ruby Hash rehash用法及代碼示例
- Ruby Hash.delete用法及代碼示例
- Ruby Hash.hash <=用法及代碼示例
- Ruby Hash size()用法及代碼示例
- Ruby Hash each_pair()用法及代碼示例
- Ruby Hash.select!用法及代碼示例
- Ruby Hash value?用法及代碼示例
- Ruby Hash values用法及代碼示例
- Ruby Hash.ruby2_keywords_hash用法及代碼示例
- Ruby Hash.rassoc(obj)用法及代碼示例
- Ruby Hash.to_s用法及代碼示例
- Ruby Hash.values_at()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Handler.start_sequence。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。