るりまサーチ

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

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

REXML::Element#root -> REXML::Element (24365.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_elements("/root/children/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}...

REXML::Element#root_node -> REXML::Document | REXML::Node (12253.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("/root/children").first
children.name # => "children"
children.root_node == doc # => true
grandchildren = doc.get_elements("/root/chil...
...dren/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root_node == doc # => true
//}...

Pathname#root? -> bool (12229.0)

self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。

...self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。

//emlist[例][ruby]{
require 'pathname'

Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//}...

REXML::Attributes#delete(attribute) -> REXML::Element (6224.0)

指定した属性を取り除きます。

...attribute で取り除く属性を指定します。
文字列もしくは REXML::Attribute オブジェクトを指定します

self
が属する要素(REXML::Element)を返します。

@param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェクト)

//emlist[][ru...
...ent'

doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

a.attributes.delete("att") # => <a foo:att='1' bar:att='2'/>
a.attributes.delete...
...("foo:att") # => <a bar:att='2'/>
attr = a.attributes.get_attribute("bar:att")
a.attributes.delete(attr) # => <a/>
//}...

REXML::Element#delete_namespace(namespace = "xmlns") -> self (6213.0)

名前空間を要素から削除します。

...除します。

@param namespace 削除する名前空間の prefix

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
doc.root.delete_namespace
doc.to_s # => "<a xmlns:foo='bar'/>"
doc.root.delete_namespace 'foo'
doc.to_s # => "<a/>"
//}...

絞り込み条件を変える

REXML::Element#has_elements? -> bool (6122.0)

self が一つでも子要素を持つならば true を返します。

...self が一つでも子要素を持つならば true を返します。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b/><c>Text</c></a>")
doc.root.has_elements? # => true
doc.elements["/a/b"].has_elements? # => false
# /a/c はテキストノードしか...
...持たないので false である
doc.elements["/a/c"].has_elements? # => false
//}...

REXML::Attributes#namespaces -> { String => String } (3240.0)

self の中で宣言されている名前空間の集合を返します。

...self の中で宣言されている名前空間の集合を返します。

返り値は名前空間の prefix をキーとし、URI を値とする
Hash を返します。

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xm...
...lns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.namespaces
# => {"foo"=>"http://example.org/foo", "bar"=>"http://example.org/bar"}
p a.attributes.namespaces
# => {}
//}...

REXML::Attributes#prefixes -> [String] (3146.0)

self の中で宣言されている prefix の集合を 文字列の配列で返します。

...self の中で宣言されている prefix の集合を
文字列の配列で返します。

self
が属する要素より上位の要素で定義されているものは含みません。

//emlist[][ruby]{
require 'rexml/document'

doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example....
...org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='&lt;'/>
</root>
EOS
a = doc.get_elements("/root/a").first

p doc.root.attributes.prefixes # => ["foo", "bar"]
p a.attributes.prefixes # => []
//}...

REXML::Text.new(arg, respect_whitespace = false, parent = nil, raw = nil, entity_filter = nil, illegal = REXML::Text::NEEDS_A_SECOND_CHECK) (3130.0)

テキストノードオブジェクトを生成します。

...して使われます。
REXML::Text オブジェクトの場合はその内容が複製されます。

respect_whitespace に真を指定すると、arg に含まれる空白文字は保存されます。
偽の場合は空白はまとめられます。

raw は true, false, nil のいずれかを...
...aw モードであるかどうかで
self
が raw モードになるかどうかが決まります。
arg に REXML::Text オブジェクトを渡した場合は、この値は無視され
arg が raw モードであるかどうかが使われます。

entity_filter は置き換えたい実体の...
...l, true).to_s # => "&lt;&amp;"
p REXML::Text.new("<&", false, nil, true).to_s # parse error
//}

//emlist[doctype があり、実体が宣言されている場合][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
doctype = REXML::Document.new(<<EOS).doctype
<!DOCTYPE root [
<!ENTITY...

ruby 1.8.3 feature (3042.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...ruby 1.8.3 feature
*((<ruby 1.8 feature>))
*((<ruby 1.8.2 feature>))

ruby 1.8.2 から ruby 1.8.3 までの変更点です。

掲載方針

*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリ...
...compat]
: FileUtils.rm_rf [lib] [compat]
: FileUtils.cd [lib] [compat]
: FileUtils.cp_r [lib] [compat]

rm_f と rm_rf が :secure オプションを受け付けるようになりました。
cd が :noop オプションを受け付けなくなりました。
cp_r が :dereference_root...
...((<ruby-talk:144741>))

class Fred
@@foo = 99
def foo
@@foo
end
end

def Fred.foo
@@foo = 101 #=> @@foo は Fred クラスのクラス変数ではない。
end

def Fred.foo_foo
class_variable_set(:@@foo, 101) # self が Fred...

絞り込み条件を変える

<< 1 2 > >>