3件ヒット
[1-3件を表示]
(0.071秒)
ライブラリ
- psych (1)
-
rexml
/ document (2)
クラス
-
Psych
:: Nodes :: Node (1) -
REXML
:: Element (2)
検索結果
先頭3件
-
REXML
:: Element # root -> REXML :: Element (54595.0) -
self が属する文書のルート要素を返します。
self が属する文書のルート要素を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name # => "root"
grandchildren = doc.get... -
REXML
:: Element # root _ node -> REXML :: Document | REXML :: Node (18559.0) -
self が属する文書のルートノードを返します。
self が属する文書のルートノードを返します。
通常はその要素が属する文書(REXML::Document) オブジェクトが
返されます。
その要素が属する REXML::Document オブジェクトが存在しない
場合は木構造上のルートノードが返されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements... -
Psych
:: Nodes :: Node # tag -> String | nil (148.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