るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.071秒)
トップページ > クエリ:-[x] > クエリ:children[x] > クエリ:Nodes[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

クラス

検索結果

Psych::Nodes::Node#children -> [Psych::Nodes::Node] (21302.0)

子ノードの集合を配列で返します。

子ノードの集合を配列で返します。

Psych::Nodes (18168.0)

Psych が中間データとして利用している AST (Abstract Syntax Tree) に 関するモジュール。

...間的な AST に変換してから
それを YAML ドキュメントに変換します。

YAML AST の各ノードのクラスはすべて Psych::Nodes の下にあります。
AST を手作業で構築して、visitor を使って AST を YAML ドキュメントや
Ruby のオブジェクトに...
...# Create our nodes
stream = Psych::Nodes::Stream.new
doc = Psych::Nodes::Document.new
seq = Psych::Nodes::Sequence.new
scalar = Psych::Nodes::Scalar.new('foo')

# Build up our tree
stream.children << doc
doc.children << seq
seq.children << scalar

stream は AST のル...
...eam.to_yaml => "---\n- foo\n"

Ruby のオブジェクトに変換するためには以下のようにします。

stream.to_ruby => [["foo"]]

=== YAML AST 仕様
正しい YAML AST は Psych::Nodes::Stream ノードが
木のルートでなければなりません。Psych::Nodes::Stream ノー...

Psych::Nodes::Node#tag -> String | nil (3136.0)

ノードに付加されたタグを返します。

...されていない場合は nil を返します。

ast = Psych.parse(<<EOS)
-
--
-
!!str a
-
b
EOS

p ast.root.children[0].value # => "a"
p ast.root.children[0].tag # => "tag:yaml.org,2002:str"

p ast.root.children[1].value # => "b"
p ast.root.children[1].tag # => nil...