struct
KYAML::Doc
Overview
A container holding both a parsed K/YAML doc tree and its sister sidecar comments.
This is only useful for cases where comments must survive the parse -> emit process unmodified. Consumers who don't need/care about comments should use straight up KYAML.parse which produces a KYAML::Any tree without any comments and no scanner overhead.
#root: the parsed K/YAML doc tree#comments: a flat list of comments in source order. Multi-doc streams partition on---, so each doc only owns its own comments.
Defined in:
kyaml/comment.crConstructors
Instance Method Summary
- #comments : Array(KYAML::Comment)
- #root : KYAML::Any
-
#to_kyaml(io : IO) : Nil
Emits this doc as complete KYAML to io.
-
#to_kyaml : String
Emits this doc as complete KYAML and returns it as a
String. -
#yaml_doc : YAML::Nodes::Document | Nil
Original parsed YAML node tree, retained so emit-side comment classification can walk it in parallel with
#rootand recover source positions.
Instance methods inherited from struct Struct
==(other : KYAML::Any)
==
Instance methods inherited from struct Value
==(other : KYAML::Any)
==
Instance methods inherited from class Object
to_kyaml(io : IO) : Nilto_kyaml(builder : KYAML::Builder) : Nil
to_kyaml : String to_kyaml
Constructor Detail
def self.new(root : KYAML::Any, comments : Array(KYAML::Comment), yaml_doc : YAML::Nodes::Document | Nil = nil)
#